Functions
Algorithms - PKCS11

Functions

WOLFSSL_API int wc_Pkcs11_Initialize (Pkcs11Dev *dev, const char *library, void *heap)
 
WOLFSSL_API void wc_Pkcs11_Finalize (Pkcs11Dev *dev)
 
WOLFSSL_API int wc_Pkcs11Token_Init (Pkcs11Token *token, Pkcs11Dev *dev, int slotId, const char *tokenName, const unsigned char *userPin, int userPinSz)
 
WOLFSSL_API void wc_Pkcs11Token_Final (Pkcs11Token *token)
 
WOLFSSL_API int wc_Pkcs11Token_Open (Pkcs11Token *token, int readWrite)
 
WOLFSSL_API void wc_Pkcs11Token_Close (Pkcs11Token *token)
 

Detailed Description

Function Documentation

◆ wc_Pkcs11_Finalize()

WOLFSSL_API void wc_Pkcs11_Finalize ( Pkcs11Dev dev)

Close the Pkcs#11 library.

Parameters
dev[in] Device object.

◆ wc_Pkcs11_Initialize()

WOLFSSL_API int wc_Pkcs11_Initialize ( Pkcs11Dev dev,
const char *  library,
void *  heap 
)

Load library, get function list and initialize PKCS#11.

Parameters
dev[in] Device object.
library[in] Library name including path.
Returns
BAD_FUNC_ARG when dev or library are NULL pointers. BAD_PATH_ERROR when dynamic library cannot be opened. WC_INIT_E when the initialization PKCS#11 fails. WC_HW_E when unable to get PKCS#11 function list. 0 on success.

◆ wc_Pkcs11Token_Close()

WOLFSSL_API void wc_Pkcs11Token_Close ( Pkcs11Token token)

Close the token's session. All object, like keys, will be destoyed.

Parameters
token[in] Token object.

◆ wc_Pkcs11Token_Final()

WOLFSSL_API void wc_Pkcs11Token_Final ( Pkcs11Token token)

Finalize token. Closes all sessions on token.

Parameters
token[in] Token object.

◆ wc_Pkcs11Token_Init()

WOLFSSL_API int wc_Pkcs11Token_Init ( Pkcs11Token token,
Pkcs11Dev dev,
int  slotId,
const char *  tokenName,
const unsigned char *  userPin,
int  userPinSz 
)

Set up a token for use.

Parameters
token[in] Token object.
dev[in] PKCS#11 device object.
slotId[in] Slot number of the token.
Passing -1 uses the first available slot.
tokenName[in] Name of token to initialize.
userPin[in] PIN to use to login as user.
userPinSz[in] Number of bytes in PIN.
Returns
BAD_FUNC_ARG when token, dev and/or tokenName is NULL. WC_INIT_E when initializing token fails. WC_HW_E when another PKCS#11 library call fails. -1 when no slot available. 0 on success.

◆ wc_Pkcs11Token_Open()

WOLFSSL_API int wc_Pkcs11Token_Open ( Pkcs11Token token,
int  readWrite 
)

Open a session on the token to be used for all operations.

Parameters
token[in] Token object.
readWrite[in] Boolean indicating to open session for Read/Write.
Returns
BAD_FUNC_ARG when token is NULL. WC_HW_E when opening the session fails. 0 on success.