forked from nss-dev/nss
-
Notifications
You must be signed in to change notification settings - Fork 0
PKCS11 API
Endi S. Dewata edited this page Jul 11, 2022
·
2 revisions
typedef CK_ULONG CK_OBJECT_CLASS; /* The following classes of objects are defined: */ /* CKO_HW_FEATURE is new for v2.10 */ /* CKO_DOMAIN_PARAMETERS is new for v2.11 */ /* CKO_MECHANISM is new for v2.20 */ #define CKO_DATA 0x00000000 #define CKO_CERTIFICATE 0x00000001 #define CKO_PUBLIC_KEY 0x00000002 #define CKO_PRIVATE_KEY 0x00000003 #define CKO_SECRET_KEY 0x00000004 #define CKO_HW_FEATURE 0x00000005 #define CKO_DOMAIN_PARAMETERS 0x00000006 #define CKO_MECHANISM 0x00000007 #define CKO_VENDOR_DEFINED 0x80000000
char *PK11_GetObjectNickname(PK11SlotInfo *slot, CK_OBJECT_HANDLE id); SECStatus PK11_SetObjectNickname(PK11SlotInfo *slot, CK_OBJECT_HANDLE id, const char *nickname); CK_OBJECT_HANDLE PK11_MatchItem(PK11SlotInfo *slot, CK_OBJECT_HANDLE peer, CK_OBJECT_CLASS o_class);
struct PK11GenericObjectStr { PK11GenericObject *prev; PK11GenericObject *next; PK11SlotInfo *slot; CK_OBJECT_HANDLE objectID; PRBool owner; }; typedef struct PK11GenericObjectStr PK11GenericObject;
-
PK11GenericObject* PK11_FindGenericObjects(PK11SlotInfo *slot, CK_OBJECT_CLASS objClass)
typedef struct CK_ATTRIBUTE { CK_ATTRIBUTE_TYPE type; CK_VOID_PTR pValue; /* ulValueLen went from CK_USHORT to CK_ULONG for v2.0 */ CK_ULONG ulValueLen; /* in bytes */ } CK_ATTRIBUTE;
crv = PK11_GetAttributes(NULL, slot, key->pkcs11ID, &theTemplate, 1);
SECKEYPrivateKeyList* PK11_ListPrivateKeysInSlot(PK11SlotInfo *slot) privkList = PK11_ListPrivKeysInSlot(slot, nickname, wincx); char* PK11_GetPrivateKeyNickname(SECKEYPrivateKey *privKey); SECStatus PK11_SetPrivateKeyNickname(SECKEYPrivateKey *privKey, const char *nickname); idItem = PK11_GetLowLevelKeyIDForPrivateKey(key); SECKEYPrivateKey* PK11_FindKeyByKeyID(PK11SlotInfo *slot, SECItem *keyID, void *wincx); SECKEYPrivateKey* PK11_FindPrivateKeyFromCert(PK11SlotInfo *slot, CERTCertificate *cert, void *wincx); SECKEYPrivateKey* PK11_FindKeyByAnyCert(CERTCertificate *cert, void *wincx); int PK11_GetPrivateModulusLen(SECKEYPrivateKey *key);
SECKEYPublicKeyList* PK11_ListPublicKeysInSlot(PK11SlotInfo* slot, char* nickname); char* PK11_GetPublicKeyNickname(SECKEYPublicKey* pubKey); SECStatus PK11_SetPublicKeyNickname(SECKEYPublicKey* pubKey, const char* nickname);
symKey = PK11_ListFixedKeysInSlot(slot, nickname, wincx); char *PK11_GetSymKeyNickname(PK11SymKey *symKey); SECStatus PK11_SetSymKeyNickname(PK11SymKey *symKey, const char *nickname);
certList = PK11_ListCertsInSlot(slot); CERTCertList *PK11_FindCertsFromNickname(const char *nickname, void *wincx); CERTCertificate *PK11_GetCertFromPrivateKey(SECKEYPrivateKey *privKey); id = PK11_GetLowLevelKeyIDForCert(NULL /*slot*/, cert, NULL/*pinarg*/);
-
SECStatus PK11_DestroyObject(PK11SlotInfo *slot, CK_OBJECT_HANDLE object)
-
SECStatus PK11_DestroyTokenObject(PK11SlotInfo *slot, CK_OBJECT_HANDLE object)
-
SECStatus PK11_DestroyGenericObject(PK11GenericObject *object)
-
SECStatus PK11_DestroyGenericObjects(PK11GenericObject *objects)