pkcs11h-core.h File Reference
pkcs11-helper core interface

pkcs11-helper core. More...

Go to the source code of this file.

## Classes

struct | pkcs11h_token_id_s
| Token identifier. More...

## Macros

#define | PKCS11H_FEATURE_MASK_ENGINE_CRYPTO_OPENSSL (1<< 0)
#define | PKCS11H_FEATURE_MASK_ENGINE_CRYPTO_GNUTLS (1<< 1)
#define | PKCS11H_FEATURE_MASK_ENGINE_CRYPTO_CRYPTOAPI (1<< 2)
#define | PKCS11H_FEATURE_MASK_ENGINE_CRYPTO_WIN32 (1<< 2)
#define | PKCS11H_FEATURE_MASK_DEBUG (1<< 3)
#define | PKCS11H_FEATURE_MASK_THREADING (1<< 4)
#define | PKCS11H_FEATURE_MASK_TOKEN (1<< 5)
#define | PKCS11H_FEATURE_MASK_DATA (1<< 6)
#define | PKCS11H_FEATURE_MASK_CERTIFICATE (1<< 7)
#define | PKCS11H_FEATURE_MASK_SLOTEVENT (1<< 8)
#define | PKCS11H_FEATURE_MASK_OPENSSL (1<< 9)
#define | PKCS11H_FEATURE_MASK_ENGINE_CRYPTO_POLARSSL (1<< 10)
#define | PKCS11H_FEATURE_MASK_ENGINE_CRYPTO_MBEDTLS (1<< 10)
#define | PKCS11H_LOG_DEBUG2 5
#define | PKCS11H_LOG_DEBUG1 4
#define | PKCS11H_LOG_INFO 3
#define | PKCS11H_LOG_WARN 2
#define | PKCS11H_LOG_ERROR 1
#define | PKCS11H_LOG_QUIET 0
#define | PKCS11H_PIN_CACHE_INFINITE -1
#define | PKCS11H_PRIVATEMODE_MASK_AUTO (0)
#define | PKCS11H_PRIVATEMODE_MASK_SIGN (1<<0)
#define | PKCS11H_PRIVATEMODE_MASK_RECOVER (1<<1)
#define | PKCS11H_PRIVATEMODE_MASK_DECRYPT (1<<2)
#define | PKCS11H_PRIVATEMODE_MASK_UNWRAP (1<<3)
#define | PKCS11H_SLOTEVENT_METHOD_TRIGGER 1
#define | PKCS11H_SLOTEVENT_METHOD_POLL 2
#define | PKCS11H_SLOTEVENT_METHOD_FETCH 3
#define | PKCS11H_PROMPT_MASK_ALLOW_PIN_PROMPT (1<<0)
#define | PKCS11H_PROMPT_MASK_ALLOW_TOKEN_PROMPT (1<<1)
#define | PKCS11H_PROMPT_MASK_ALLOW_KEY_PROMPT (1<<2)
#define | PKCS11H_PROMPT_MASK_ALLOW_ALL
#define | PKCS11H_ENUM_METHOD_CACHE 0
#define | PKCS11H_ENUM_METHOD_CACHE_EXIST 1
#define | PKCS11H_ENUM_METHOD_RELOAD 2
#define | PKCS11H_PROPERTY_FORK_MODE 1
| How does the foked process bahaves after POSIX fork() Value is PKCS11H_BOOL. Default is FALSE.
#define | PKCS11H_PROPERTY_LOG_HOOK 2
| A log callback. Value is pkcs11h_hook_log_t.
#define | PKCS11H_PROPERTY_LOG_HOOK_DATA 3
| A log callback data. Value is void *.
#define | PKCS11H_PROPERTY_SLOT_EVENT_HOOK 4
| A slot event callback. Value is pkcs11h_hook_slotevent_t.
#define | PKCS11H_PROPERTY_SLOT_EVENT_HOOK_DATA 5
| A slot event callback data. Value is void *.
#define | PKCS11H_PROPERTY_TOKEN_PROMPT_HOOK 6
| A token prompt callback. Value type is pkcs11h_hook_token_prompt_t.
#define | PKCS11H_PROPERTY_TOKEN_PROMPT_HOOK_DATA 7
| A token prompt callback data. Value is void *.
#define | PKCS11H_PROPERTY_PIN_PROMPT_HOOK 8
| A pin prompt callback. Value type is pkcs11h_hook_pin_prompt_t.
#define | PKCS11H_PROPERTY_PIN_PROMPT_HOOK_DATA 9
| A PIN prompt callback data. Value is void *.
#define | PKCS11H_PROPERTY_ALLOW_PROTECTED_AUTHENTICATION 10
| Global protected authentication mode. Value is PKCS11H_BOOL. Default is TRUE.
#define | PKCS11H_PROPERTY_PIN_CACHE_PERIOD 11
| Global PIN cache timeout in seconds. Value is int. Default is infinite.
#define | PKCS11H_PROPERTY_MAX_LOGIN_RETRIES 12
| Global login retries attempts. Value is unsigned. Default is 3.
#define | PKCS11H_PROPERTY_KEY_PROMPT_HOOK 13
| A key prompt callback. Value type is pkcs11h_hook_key_prompt_t.
#define | PKCS11H_PROPERTY_KEY_PROMPT_HOOK_DATA 14
| A key prompt callback data. Value is void *.
#define | PKCS11H_PROVIDER_PROPERTY_LOCATION 0
| Provider location. Value type is char*.
#define | PKCS11H_PROVIDER_PROPERTY_ALLOW_PROTECTED_AUTH 1
| Allow this provider to use protected authentication. Value type is PKCS11H_BOOL. Default value is False.
#define | PKCS11H_PROVIDER_PROPERTY_MASK_PRIVATE_MODE 2
| Provider private mode PKCS11H_PRIVATEMODE_MASK override. Value type is unsigened. Default value is PKCS11H_PRIVATEMODE_MASK_AUTO.
#define | PKCS11H_PROVIDER_PROPERTY_SLOT_EVENT_METHOD 3
| Provider slot event PKCS11H_SLOTEVENT_METHOD method. Value type is unsigned. Default value is PKCS11H_SLOTEVENT_METHOD_AUTO.
#define | PKCS11H_PROVIDER_PROPERTY_SLOT_POLL_INTERVAL 4
| Slot event poll interval (If in polling mode). Value type is unsigned. Default value is 0.
#define | PKCS11H_PROVIDER_PROPERTY_INIT_ARGS 6
| Provider initialize arguments. Value type is CK_C_INITIALIZE_ARGS_PTR. Default value is NULL.
#define | PKCS11H_PROVIDER_PROPERTY_PROVIDER_DESTRUCT_HOOK 7
| Provider destruct hook. Value type is pkcs11h_provider_destruct_hook_t.
#define | PKCS11H_PROVIDER_PROPERTY_PROVIDER_DESTRUCT_HOOK_DATA 8
| Provider destruct notification data. Value type is void *.
#define | PKCS11H_PROVIDER_PROPERTY_LOADER_FLAGS 9
| Provider loader flags for platform. Value type is unsigned. Default value is platform dependent: win32 -> 0 dlopen -> RTLD_NOW | RTLD_LOCAL.

## Typedefs

typedef struct pkcs11h_token_id_s * | pkcs11h_token_id_t
| Token identifier.
typedef void(* | pkcs11h_hook_log_t) (IN void *const global_data, IN const unsigned flags, IN const char *const format, IN va_list args)
| Log hook.
typedef void(* | pkcs11h_hook_slotevent_t) (IN void *const global_data)
| Slotevent hook.
typedef PKCS11H_BOOL(* | pkcs11h_hook_token_prompt_t) (IN void *const global_data, IN void *const user_data, IN const pkcs11h_token_id_t token, IN const unsigned retry)
| Token prompt hook.
typedef PKCS11H_BOOL(* | pkcs11h_hook_pin_prompt_t) (IN void *const global_data, IN void *const user_data, IN const pkcs11h_token_id_t token, IN const unsigned retry, OUT char *const pin, IN const size_t pin_max)
| PIN prompt hook.
typedef PKCS11H_BOOL(* | pkcs11h_hook_key_prompt_t) (IN void *const global_data, IN void *const user_data, IN const pkcs11h_token_id_t token, IN const char *const label, IN const unsigned retry, OUT char *const pin, IN const size_t pin_max)
| Key prompt hook.

## Functions

const char * | pkcs11h_getMessage (IN const CK_RV rv)
| Get message by return value.
unsigned int | pkcs11h_getVersion (void)
| Get version of library.
unsigned int | pkcs11h_getFeatures (void)
| Get features of library.
CK_RV | pkcs11h_initialize (void)
| Initialize helper interface.
CK_RV | pkcs11h_terminate (void)
| Terminate helper interface.
CK_RV | pkcs11h_getProperty (IN const unsigned property, OUT void *const value, IN OUT size_t *const value_size)
| Get library property.
CK_RV | pkcs11h_setProperty (IN const unsigned property, IN const void *const value, IN const size_t value_size)
| Set library property.
void | pkcs11h_setLogLevel (IN const unsigned flags)
| Set current log level of the helper.
unsigned | pkcs11h_getLogLevel (void)
| Get current log level.
CK_RV | pkcs11h_setForkMode (IN const PKCS11H_BOOL safe)
| How does the foked process bahaves after POSIX fork()
CK_RV | pkcs11h_setLogHook (IN const pkcs11h_hook_log_t hook, IN void *const global_data)
| Set a log callback.
CK_RV | pkcs11h_setSlotEventHook (IN const pkcs11h_hook_slotevent_t hook, IN void *const global_data)
| Set a slot event callback.
CK_RV | pkcs11h_setTokenPromptHook (IN const pkcs11h_hook_token_prompt_t hook, IN void *const global_data)
| Set a token prompt callback.
CK_RV | pkcs11h_setPINPromptHook (IN const pkcs11h_hook_pin_prompt_t hook, IN void *const global_data)
| Set a pin prompt callback.
CK_RV | pkcs11h_setProtectedAuthentication (IN const PKCS11H_BOOL allow_protected_auth)
| Set global protected authentication mode.
CK_RV | pkcs11h_setPINCachePeriod (IN const int pin_cache_period)
| Set global PIN cache timeout.
CK_RV | pkcs11h_setMaxLoginRetries (IN const unsigned max_retries)
| Set global login retries attempts.
CK_RV | pkcs11h_addProvider (IN const char *const reference, IN const char *const provider_location, IN const PKCS11H_BOOL allow_protected_auth, IN const unsigned mask_private_mode, IN const unsigned slot_event_method, IN const unsigned slot_poll_interval, IN const PKCS11H_BOOL cert_is_private)
| Register, configure and initialize a PKCS#11 provider.
CK_RV | pkcs11h_registerProvider (IN const char *const reference)
| Register a PKCS#11 provider.
CK_RV | pkcs11h_setProviderPropertyByName (IN const char *const reference, IN const char *const property_str, IN const char *const value_str)
| Set PKCS#11 provider property by name.
CK_RV | pkcs11h_setProviderProperty (IN const char *const reference, IN const unsigned property, IN const void *value, IN const size_t value_size)
| Set PKCS#11 provider property.
CK_RV | pkcs11h_initializeProvider (IN const char *const reference)
| Initialize a PKCS#11 provider.
CK_RV | pkcs11h_removeProvider (IN const char *const reference)
| Delete a PKCS#11 provider.
CK_RV | pkcs11h_forkFixup (void)
| Handle special case of POSIX fork()
CK_RV | pkcs11h_plugAndPlay (void)
| Handle slot rescan.
CK_RV | pkcs11h_logout (void)
| Logout from all sessions.

## Detailed Description

pkcs11-helper core.

Author
  Alon Bar-Lev alon..nosp@m.barl.nosp@m.ev@gm.nosp@m.ail..nosp@m.com

See also
  pkcs11-helper core interface.

pkcs11-helper, Copyright (C) Alon Bar-Lev <alon.barlev@gmail.com> |