corePKCS11 Interface. More...
#include "core_pkcs11_config.h"
#include "core_pkcs11_config_defaults.h"
#include "core_pkcs11.h"
#include "pkcs11t.h"
#include <stdio.h>
#include <stdint.h>
#include <string.h>
Functions | |
CK_RV | xGetSlotList (CK_SLOT_ID **ppxSlotId, CK_ULONG *pxSlotCount) |
Get a list of available PKCS #11 slots. | |
CK_RV | xInitializePKCS11 (void) |
Initializes a PKCS #11 session. | |
CK_RV | xInitializePkcs11Token (void) |
Initializes a PKCS #11 module and token. | |
CK_RV | xInitializePkcs11Session (CK_SESSION_HANDLE *pxSession) |
Initializes the PKCS #11 module and opens a session. | |
CK_RV | xFindObjectWithLabelAndClass (CK_SESSION_HANDLE xSession, char *pcLabelName, CK_ULONG ulLabelNameLen, CK_OBJECT_CLASS xClass, CK_OBJECT_HANDLE_PTR pxHandle) |
Searches for an object with a matching label and class provided. | |
CK_RV | vAppendSHA256AlgorithmIdentifierSequence (const uint8_t *puc32ByteHashedMessage, uint8_t *puc51ByteHashOidBuffer) |
Appends digest algorithm sequence to SHA-256 hash for RSA signatures. | |
corePKCS11 Interface.
This file contains wrapper functions for common PKCS #11 operations.
CK_RV xGetSlotList | ( | CK_SLOT_ID ** | ppxSlotId, |
CK_ULONG * | pxSlotCount | ||
) |
Get a list of available PKCS #11 slots.
[out] | ppxSlotId | Pointer to slot list. This slot list is malloc'ed by the function and must be freed by the caller. |
[out] | pxSlotCount | Pointer to the number of slots found. |
CK_RV xInitializePKCS11 | ( | void | ) |
Initializes a PKCS #11 session.
CK_RV xInitializePkcs11Token | ( | void | ) |
Initializes a PKCS #11 module and token.
CK_RV xInitializePkcs11Session | ( | CK_SESSION_HANDLE * | pxSession | ) |
Initializes the PKCS #11 module and opens a session.
[out] | pxSession | Pointer to the PKCS #11 session handle that is created by this function. |
CK_RV xFindObjectWithLabelAndClass | ( | CK_SESSION_HANDLE | xSession, |
char * | pcLabelName, | ||
CK_ULONG | ulLabelNameLen, | ||
CK_OBJECT_CLASS | xClass, | ||
CK_OBJECT_HANDLE_PTR | pxHandle | ||
) |
Searches for an object with a matching label and class provided.
[in] | xSession | An open PKCS #11 session. |
[in] | pcLabelName | A pointer to the object's label (CKA_LABEL). |
[in] | ulLabelNameLen | The size (in bytes) of pcLabelName. |
[in] | xClass | The class (CKA_CLASS) of the object. ex: CKO_PUBLIC_KEY, CKO_PRIVATE_KEY, CKO_CERTIFICATE |
[out] | pxHandle | Pointer to the location where the handle of the found object should be placed. |
CK_RV vAppendSHA256AlgorithmIdentifierSequence | ( | const uint8_t * | puc32ByteHashedMessage, |
uint8_t * | puc51ByteHashOidBuffer | ||
) |
Appends digest algorithm sequence to SHA-256 hash for RSA signatures.
This function pre-appends the digest algorithm identifier to the SHA-256 hash of a message.
DigestInfo :: = SEQUENCE{ digestAlgorithm DigestAlgorithmIdentifier, digest Digest }
[in] | puc32ByteHashedMessage | A 32-byte buffer containing the SHA-256 hash of the data to be signed. |
[out] | puc51ByteHashOidBuffer | A 51-byte output buffer containing the DigestInfo structure. This memory must be allocated by the caller. |