pkcs11-helper
Token interface

Files

file  pkcs11h-token.h
 pkcs11-helper token interface.
 

Classes

struct  pkcs11h_token_id_list_s
 Token identifier list. More...
 

Typedefs

typedef struct pkcs11h_token_id_list_spkcs11h_token_id_list_t
 Token identifier list.
 

Functions

CK_RV pkcs11h_token_freeTokenId (IN pkcs11h_token_id_t token_id)
 Free token_id object.
 
CK_RV pkcs11h_token_duplicateTokenId (OUT pkcs11h_token_id_t *const to, IN const pkcs11h_token_id_t from)
 Duplicate token_id object.
 
PKCS11H_BOOL pkcs11h_token_sameTokenId (IN const pkcs11h_token_id_t a, IN const pkcs11h_token_id_t b)
 Returns TRUE if same token id.
 
CK_RV pkcs11h_token_logout (IN const pkcs11h_token_id_t token_id)
 Force logout.
 
CK_RV pkcs11h_token_login (IN const pkcs11h_token_id_t token_id, IN const PKCS11H_BOOL readonly, IN const char *const pin)
 Force login, avoid hooks.
 
CK_RV pkcs11h_token_ensureAccess (IN const pkcs11h_token_id_t token_id, IN void *const user_data, IN const unsigned mask_prompt)
 Ensure token is accessible.
 
CK_RV pkcs11h_token_freeTokenIdList (IN const pkcs11h_token_id_list_t token_id_list)
 Free certificate_id list.
 
CK_RV pkcs11h_token_enumTokenIds (IN const unsigned method, OUT pkcs11h_token_id_list_t *const p_token_id_list)
 Enumerate available tokens.
 
CK_RV pkcs11h_token_serializeTokenId (OUT char *const sz, IN OUT size_t *max, IN const pkcs11h_token_id_t token_id)
 Serialize token_id into string.
 
CK_RV pkcs11h_token_deserializeTokenId (OUT pkcs11h_token_id_t *p_token_id, IN const char *const sz)
 Deserialize token_id from string.
 

Detailed Description

Token related functions.

Function Documentation

◆ pkcs11h_token_deserializeTokenId()

CK_RV pkcs11h_token_deserializeTokenId ( OUT pkcs11h_token_id_t * p_token_id,
IN const char *const sz )

Deserialize token_id from string.

Parameters
p_token_idid.
szInput string.
Returns
CK_RV.
Note
Caller must free result.
See also
pkcs11h_token_freeTokenId().

◆ pkcs11h_token_duplicateTokenId()

CK_RV pkcs11h_token_duplicateTokenId ( OUT pkcs11h_token_id_t *const to,
IN const pkcs11h_token_id_t from )

Duplicate token_id object.

Parameters
toTarget.
fromSource.
Returns
CK_RV.
See also
pkcs11h_token_freeTokenId().

◆ pkcs11h_token_ensureAccess()

CK_RV pkcs11h_token_ensureAccess ( IN const pkcs11h_token_id_t token_id,
IN void *const user_data,
IN const unsigned mask_prompt )

Ensure token is accessible.

Parameters
token_idToken id object.
user_dataOptional user data, to be passed to hooks.
mask_promptAllow prompt PKCS11H_PROMPT_MASK.
Returns
CK_RV.

◆ pkcs11h_token_enumTokenIds()

CK_RV pkcs11h_token_enumTokenIds ( IN const unsigned method,
OUT pkcs11h_token_id_list_t *const p_token_id_list )

Enumerate available tokens.

Parameters
methodEnum method PKCS11H_ENUM_METHOD.
p_token_id_listList.
Returns
CK_RV.
Note
Caller must free result.
See also
pkcs11h_token_freeTokenIdList().

◆ pkcs11h_token_freeTokenId()

CK_RV pkcs11h_token_freeTokenId ( IN pkcs11h_token_id_t token_id)

Free token_id object.

Parameters
token_idToken reference.
Returns
CK_RV.

◆ pkcs11h_token_freeTokenIdList()

CK_RV pkcs11h_token_freeTokenIdList ( IN const pkcs11h_token_id_list_t token_id_list)

Free certificate_id list.

Parameters
token_id_listList.
Returns
CK_RV.

◆ pkcs11h_token_login()

CK_RV pkcs11h_token_login ( IN const pkcs11h_token_id_t token_id,
IN const PKCS11H_BOOL readonly,
IN const char *const pin )

Force login, avoid hooks.

Parameters
token_idToken to login into.
readonlyShould session be readonly.
pinPIN to login, NULL for protected authentication.
Returns
CK_RV.

◆ pkcs11h_token_logout()

CK_RV pkcs11h_token_logout ( IN const pkcs11h_token_id_t token_id)

Force logout.

Parameters
token_idToken to login into.
Returns
CK_RV.

◆ pkcs11h_token_sameTokenId()

PKCS11H_BOOL pkcs11h_token_sameTokenId ( IN const pkcs11h_token_id_t a,
IN const pkcs11h_token_id_t b )

Returns TRUE if same token id.

Parameters
aa.
bb.
Returns
TRUE if same token identifier.

◆ pkcs11h_token_serializeTokenId()

CK_RV pkcs11h_token_serializeTokenId ( OUT char *const sz,
IN OUT size_t * max,
IN const pkcs11h_token_id_t token_id )

Serialize token_id into string.

Parameters
szOutput string.
maxMaximum string size.
token_idid to serialize
Returns
CK_RV.
Note
sz may be NULL to get size.

pkcs11-helper, Copyright (C) Alon Bar-Lev <alon.barlev@gmail.com>OpenSC-Project.org Logo