12#include <botan/exceptn.h>
13#include <botan/secmem.h>
24 #define CK_DECLARE_FUNCTION(returnType, name) returnType __declspec(dllimport) name
26 #define CK_DECLARE_FUNCTION(returnType, name) returnType name
30 #define CK_DECLARE_FUNCTION_POINTER(returnType, name) returnType __declspec(dllimport)(*name)
32 #define CK_DECLARE_FUNCTION_POINTER(returnType, name) returnType(*name)
35#define CK_CALLBACK_FUNCTION(returnType, name) returnType(*name)
38 #define NULL_PTR nullptr
42 #pragma pack(push, cryptoki, 1)
50 #pragma pack(pop, cryptoki)
56 "The Botan PKCS#11 module was implemented against PKCS#11 v2.40. Please use the correct PKCS#11 headers.");
60class Dynamically_Loaded_Library;
982 std::vector<SlotId>& slot_ids,
1067 std::vector<MechanismType>& mechanisms,
1129 template <
typename TAlloc>
1131 const std::vector<uint8_t, TAlloc>& so_pin,
1132 std::string_view label,
1134 std::string padded_label(label);
1135 if(label.size() < 32) {
1136 padded_label.insert(padded_label.end(), 32 - label.size(),
' ');
1140 reinterpret_cast<Utf8Char*
>(
const_cast<uint8_t*
>(so_pin.data())),
1141 static_cast<Ulong>(so_pin.size()),
1142 reinterpret_cast<Utf8Char*
>(
const_cast<char*
>(padded_label.c_str())),
1182 template <
typename TAlloc>
1184 const std::vector<uint8_t, TAlloc>& pin,
1187 reinterpret_cast<Utf8Char*
>(
const_cast<uint8_t*
>(pin.data())),
1188 static_cast<Ulong>(pin.size()),
1233 template <
typename TAlloc>
1235 const std::vector<uint8_t, TAlloc>& old_pin,
1236 const std::vector<uint8_t, TAlloc>& new_pin,
1239 reinterpret_cast<Utf8Char*
>(
const_cast<uint8_t*
>(old_pin.data())),
1240 static_cast<Ulong>(old_pin.size()),
1241 reinterpret_cast<Utf8Char*
>(
const_cast<uint8_t*
>(new_pin.data())),
1242 static_cast<Ulong>(new_pin.size()),
1266 bool C_OpenSession(
SlotId slot_id,
1334 Byte* operation_state_ptr,
1335 Ulong* operation_state_len_ptr,
1356 Byte* operation_state_ptr,
1357 Ulong operation_state_len,
1403 template <
typename TAlloc>
1406 const std::vector<uint8_t, TAlloc>& pin,
1410 reinterpret_cast<Utf8Char*
>(
const_cast<uint8_t*
>(pin.data())),
1411 static_cast<Ulong>(pin.size()),
1557 template <
typename TAlloc>
1560 std::map<
AttributeType, std::vector<uint8_t, TAlloc>>& attribute_values,
1562 std::vector<Attribute> getter_template;
1564 getter_template.reserve(attribute_values.size());
1565 for(
const auto& entry : attribute_values) {
1571 const_cast<Attribute*
>(getter_template.data()),
1572 static_cast<Ulong>(getter_template.size()),
1580 for(
auto& entry : attribute_values) {
1581 entry.second.clear();
1582 entry.second.resize(getter_template.at(i).ulValueLen);
1583 getter_template.at(i).pValue =
const_cast<uint8_t*
>(entry.second.data());
1589 const_cast<Attribute*
>(getter_template.data()),
1590 static_cast<Ulong>(getter_template.size()),
1635 template <
typename TAlloc>
1638 std::map<
AttributeType, std::vector<uint8_t, TAlloc>>& attribute_values,
1640 std::vector<Attribute> setter_template;
1642 setter_template.reserve(attribute_values.size());
1643 for(
auto& entry : attribute_values) {
1645 entry.second.data(),
1646 static_cast<CK_ULONG>(entry.second.size())});
1651 const_cast<Attribute*
>(setter_template.data()),
1652 static_cast<Ulong>(setter_template.size()),
1693 Ulong max_object_count,
1694 Ulong* object_count_ptr,
1756 Byte* encrypted_data,
1757 Ulong* encrypted_data_len_ptr,
1776 template <
typename TAllocA,
typename TAllocB>
1778 const std::vector<uint8_t, TAllocA>& plaintext_data,
1779 std::vector<uint8_t, TAllocB>& encrypted_data,
1781 Ulong encrypted_size = 0;
1783 const_cast<Byte*
>((plaintext_data.data())),
1784 static_cast<Ulong>(plaintext_data.size()),
1791 encrypted_data.resize(encrypted_size);
1793 const_cast<Byte*
>(plaintext_data.data()),
1794 static_cast<Ulong>(plaintext_data.size()),
1795 encrypted_data.data(),
1800 encrypted_data.resize(encrypted_size);
1824 Byte* encrypted_part_ptr,
1825 Ulong* encrypted_part_len_ptr,
1844 Byte* last_encrypted_part_ptr,
1845 Ulong* last_encrypted_part_len_ptr,
1891 Byte* encrypted_data_ptr,
1892 Ulong encrypted_data_len,
1894 Ulong* data_len_ptr,
1913 template <
typename TAllocA,
typename TAllocB>
1915 const std::vector<uint8_t, TAllocA>& encrypted_data,
1916 std::vector<uint8_t, TAllocB>& decrypted_data,
1918 Ulong decrypted_size = 0;
1920 const_cast<Byte*
>((encrypted_data.data())),
1921 static_cast<Ulong>(encrypted_data.size()),
1928 decrypted_data.resize(decrypted_size);
1930 const_cast<Byte*
>(encrypted_data.data()),
1931 static_cast<Ulong>(encrypted_data.size()),
1932 decrypted_data.data(),
1937 decrypted_data.resize(decrypted_size);
1960 Byte* encrypted_part_ptr,
1961 Ulong encrypted_part_len,
1963 Ulong* part_len_ptr,
1983 Byte* last_part_ptr,
1984 Ulong* last_part_len_ptr,
2029 Ulong* digest_len_ptr,
2085 Ulong* digest_len_ptr,
2131 const Byte* data_ptr,
2133 Byte* signature_ptr,
2134 Ulong* signature_len_ptr,
2153 template <
typename TAllocA,
typename TAllocB>
2155 const std::vector<uint8_t, TAllocA>& data,
2156 std::vector<uint8_t, TAllocB>& signature,
2158 Ulong signature_size = 0;
2159 if(!
C_Sign(session, data.data(),
static_cast<Ulong>(data.size()),
nullptr, &signature_size, return_value)) {
2163 signature.resize(signature_size);
2166 static_cast<Ulong>(data.size()),
2172 signature.resize(signature_size);
2192 const Byte* part_ptr,
2210 template <
typename TAlloc>
2212 const std::vector<uint8_t, TAlloc>& part,
2214 return C_SignUpdate(session, part.data(),
static_cast<Ulong>(part.size()), return_value);
2234 Byte* signature_ptr,
2235 Ulong* signature_len_ptr,
2253 template <
typename TAlloc>
2255 std::vector<uint8_t, TAlloc>& signature,
2257 Ulong signature_size = 0;
2258 if(!
C_SignFinal(session,
nullptr, &signature_size, return_value)) {
2262 signature.resize(signature_size);
2263 if(!
C_SignFinal(session, signature.data(), &signature_size, return_value)) {
2266 signature.resize(signature_size);
2313 Byte* signature_ptr,
2314 Ulong* signature_len_ptr,
2360 const Byte* data_ptr,
2362 const Byte* signature_ptr,
2363 Ulong signature_len,
2382 template <
typename TAllocA,
typename TAllocB>
2384 const std::vector<uint8_t, TAllocA>& data,
2385 std::vector<uint8_t, TAllocB>& signature,
2389 static_cast<Ulong>(data.size()),
2391 static_cast<Ulong>(signature.size()),
2411 const Byte* part_ptr,
2429 template <
typename TAlloc>
2431 std::vector<uint8_t, TAlloc> part,
2433 return C_VerifyUpdate(session, part.data(),
static_cast<Ulong>(part.size()), return_value);
2453 const Byte* signature_ptr,
2454 Ulong signature_len,
2498 Byte* signature_ptr,
2499 Ulong signature_len,
2501 Ulong* data_len_ptr,
2526 Byte* encrypted_part_ptr,
2527 Ulong* encrypted_part_len_ptr,
2549 Byte* encrypted_part_ptr,
2550 Ulong encrypted_part_len,
2552 Ulong* part_len_ptr,
2576 Byte* encrypted_part_ptr,
2577 Ulong* encrypted_part_len_ptr,
2599 Byte* encrypted_part_ptr,
2600 Ulong encrypted_part_len,
2602 Ulong* part_len_ptr,
2662 Ulong public_key_attribute_count,
2664 Ulong private_key_attribute_count,
2695 Byte* wrapped_key_ptr,
2696 Ulong* wrapped_key_len_ptr,
2728 Byte* wrapped_key_ptr,
2729 Ulong wrapped_key_len,
2731 Ulong attribute_count,
2762 Ulong attribute_count,
2785 const Byte* seed_ptr,
2805 Byte* random_data_ptr,
2853 static bool handle_return_value(
CK_RV function_result,
ReturnValue* return_value);
2873 int error_code() const noexcept
override {
return static_cast<int>(m_return_val); }
#define BOTAN_PUBLIC_API(maj, min)
const char * what() const noexcept override
Exception(std::string_view msg)
bool C_Finalize(VoidPtr reserved, ReturnValue *return_value=ThrowException) const
bool C_InitPIN(SessionHandle session, const std::vector< uint8_t, TAlloc > &pin, ReturnValue *return_value=ThrowException) const
bool C_SetAttributeValue(SessionHandle session, ObjectHandle object, std::map< AttributeType, std::vector< uint8_t, TAlloc > > &attribute_values, ReturnValue *return_value=ThrowException) const
bool C_Sign(SessionHandle session, const std::vector< uint8_t, TAllocA > &data, std::vector< uint8_t, TAllocB > &signature, ReturnValue *return_value=ThrowException) const
bool C_SetPIN(SessionHandle session, const std::vector< uint8_t, TAlloc > &old_pin, const std::vector< uint8_t, TAlloc > &new_pin, ReturnValue *return_value=ThrowException) const
bool C_SignUpdate(SessionHandle session, const std::vector< uint8_t, TAlloc > &part, ReturnValue *return_value=ThrowException) const
bool C_WaitForSlotEvent(Flags flags, SlotId *slot_ptr, VoidPtr reserved, ReturnValue *return_value=ThrowException) const
bool C_GetTokenInfo(SlotId slot_id, TokenInfo *info_ptr, ReturnValue *return_value=ThrowException) const
bool C_InitToken(SlotId slot_id, const std::vector< uint8_t, TAlloc > &so_pin, std::string_view label, ReturnValue *return_value=ThrowException) const
bool C_SetAttributeValue(SessionHandle session, ObjectHandle object, Attribute *attribute_template_ptr, Ulong count, ReturnValue *return_value=ThrowException) const
static bool C_GetFunctionList(Dynamically_Loaded_Library &pkcs11_module, FunctionListPtr *function_list_ptr_ptr, ReturnValue *return_value=ThrowException)
LowLevel(FunctionListPtr ptr)
bool C_Login(SessionHandle session, UserType user_type, const std::vector< uint8_t, TAlloc > &pin, ReturnValue *return_value=ThrowException) const
bool C_GetSlotInfo(SlotId slot_id, SlotInfo *info_ptr, ReturnValue *return_value=ThrowException) const
bool C_VerifyUpdate(SessionHandle session, const Byte *part_ptr, Ulong part_len, ReturnValue *return_value=ThrowException) const
bool C_GetAttributeValue(SessionHandle session, ObjectHandle object, Attribute *attribute_template_ptr, Ulong count, ReturnValue *return_value=ThrowException) const
bool C_InitPIN(SessionHandle session, Utf8Char *pin_ptr, Ulong pin_len, ReturnValue *return_value=ThrowException) const
bool C_Initialize(VoidPtr init_args, ReturnValue *return_value=ThrowException) const
bool C_Sign(SessionHandle session, const Byte *data_ptr, Ulong data_len, Byte *signature_ptr, Ulong *signature_len_ptr, ReturnValue *return_value=ThrowException) const
bool C_Encrypt(SessionHandle session, const std::vector< uint8_t, TAllocA > &plaintext_data, std::vector< uint8_t, TAllocB > &encrypted_data, ReturnValue *return_value=ThrowException) const
bool C_SignUpdate(SessionHandle session, const Byte *part_ptr, Ulong part_len, ReturnValue *return_value=ThrowException) const
bool C_Verify(SessionHandle session, const std::vector< uint8_t, TAllocA > &data, std::vector< uint8_t, TAllocB > &signature, ReturnValue *return_value=ThrowException) const
bool C_GetInfo(Info *info_ptr, ReturnValue *return_value=ThrowException) const
bool C_GetMechanismList(SlotId slot_id, MechanismType *mechanism_list_ptr, Ulong *count_ptr, ReturnValue *return_value=ThrowException) const
bool C_Decrypt(SessionHandle session, const std::vector< uint8_t, TAllocA > &encrypted_data, std::vector< uint8_t, TAllocB > &decrypted_data, ReturnValue *return_value=ThrowException) const
bool C_Decrypt(SessionHandle session, Byte *encrypted_data_ptr, Ulong encrypted_data_len, Byte *data_ptr, Ulong *data_len_ptr, ReturnValue *return_value=ThrowException) const
bool C_VerifyUpdate(SessionHandle session, std::vector< uint8_t, TAlloc > part, ReturnValue *return_value=ThrowException) const
bool C_Encrypt(SessionHandle session, Byte *data_ptr, Ulong data_len, Byte *encrypted_data, Ulong *encrypted_data_len_ptr, ReturnValue *return_value=ThrowException) const
bool C_SignFinal(SessionHandle session, std::vector< uint8_t, TAlloc > &signature, ReturnValue *return_value=ThrowException) const
bool C_GetSlotList(Bbool token_present, SlotId *slot_list_ptr, Ulong *count_ptr, ReturnValue *return_value=ThrowException) const
bool C_GetMechanismInfo(SlotId slot_id, MechanismType type, MechanismInfo *info_ptr, ReturnValue *return_value=ThrowException) const
bool C_Login(SessionHandle session, UserType user_type, Utf8Char *pin_ptr, Ulong pin_len, ReturnValue *return_value=ThrowException) const
bool C_SignFinal(SessionHandle session, Byte *signature_ptr, Ulong *signature_len_ptr, ReturnValue *return_value=ThrowException) const
FunctionListPtr get_functions() const
bool C_InitToken(SlotId slot_id, Utf8Char *so_pin_ptr, Ulong so_pin_len, Utf8Char *label_ptr, ReturnValue *return_value=ThrowException) const
bool C_Verify(SessionHandle session, const Byte *data_ptr, Ulong data_len, const Byte *signature_ptr, Ulong signature_len, ReturnValue *return_value=ThrowException) const
bool C_SetPIN(SessionHandle session, Utf8Char *old_pin_ptr, Ulong old_len, Utf8Char *new_pin_ptr, Ulong new_len, ReturnValue *return_value=ThrowException) const
bool C_GetAttributeValue(SessionHandle session, ObjectHandle object, std::map< AttributeType, std::vector< uint8_t, TAlloc > > &attribute_values, ReturnValue *return_value=ThrowException) const
ErrorType error_type() const noexcept override
PKCS11_Error(std::string_view what)
int error_code() const noexcept override
ReturnValue get_return_value() const
PKCS11_ReturnError(ReturnValue return_val)
CK_RSA_PKCS_OAEP_PARAMS RsaPkcsOaepParams
CK_DESTROYMUTEX DestroyMutex
@ Pkcs5Pbkd2HmacSha512256
@ Pkcs5Pbkd2HmacGostr3411
@ Pkcs5Pbkd2HmacSha512224
ReturnValue * ThrowException
CK_CREATEMUTEX CreateMutex
secure_vector< uint8_t > secure_string
@ OtpChallengeRequirement
CK_C_INITIALIZE_ARGS C_InitializeArgs
void change_pin(Slot &slot, const secure_string &old_pin, const secure_string &new_pin)
CK_ECDH1_DERIVE_PARAMS Ecdh1DeriveParams
CK_OBJECT_HANDLE ObjectHandle
void change_so_pin(Slot &slot, const secure_string &old_so_pin, const secure_string &new_so_pin)
@ DsaShaweTaylorParameterGen
@ WtlsServerKeyAndMacDerive
@ WtlsClientKeyAndMacDerive
@ DsaProbablisticParameterGen
@ WtlsMasterKeyDeriveDhEcc
CK_UNLOCKMUTEX UnlockMutex
@ LibraryCantCreateOsThreads
@ ProtectedAuthenticationPath
@ SecondaryAuthentication
CK_FUNCTION_LIST_PTR FunctionListPtr
Flag operator|(Flag a, Flag b)
CK_SESSION_INFO SessionInfo
CK_RSA_PKCS_PSS_PARAMS RsaPkcsPssParams
void set_pin(Slot &slot, const secure_string &so_pin, const secure_string &pin)
CK_MECHANISM_INFO MechanismInfo
@ SessionReadWriteSoExists
@ SessionParallelNotSupported
@ UnwrappingKeyHandleInvalid
@ UserAnotherAlreadyLoggedIn
@ UnwrappingKeyTypeInconsistent
@ KeyFunctionNotPermitted
@ CryptokiAlreadyInitialized
@ WrappingKeyTypeInconsistent
@ OperationNotInitialized
@ WrappingKeyHandleInvalid
void initialize_token(Slot &slot, std::string_view label, const secure_string &so_pin, const secure_string &pin)
CK_SESSION_HANDLE SessionHandle
std::vector< T, secure_allocator< T > > secure_vector
std::string to_string(ErrorType type)
Convert an ErrorType to string.
#define CKA_NEVER_EXTRACTABLE
#define CKM_TLS_MASTER_KEY_DERIVE
#define CKM_DSA_PARAMETER_GEN
#define CKR_SESSION_COUNT
#define CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE
#define CKM_CONCATENATE_BASE_AND_DATA
#define CKR_DEVICE_MEMORY
#define CKA_JAVA_MIDP_SECURITY_DOMAIN
#define CKM_SSL3_SHA1_MAC
#define CKA_OTP_TIME_INTERVAL
#define CKA_SECONDARY_AUTH
#define CKR_GENERAL_ERROR
#define CKR_MECHANISM_INVALID
#define CKR_SLOT_ID_INVALID
#define CKC_VENDOR_DEFINED
#define CKM_SSL3_MASTER_KEY_DERIVE
#define CKR_ATTRIBUTE_TYPE_INVALID
#define CKA_OTP_SERVICE_IDENTIFIER
#define CKM_GOSTR3411_HMAC
#define CKM_WTLS_PRE_MASTER_KEY_GEN
#define CKA_AUTH_PIN_FLAGS
#define CKM_SHA256_KEY_DERIVATION
#define CKA_SERIAL_NUMBER
#define CKM_CAST5_MAC_GENERAL
#define CKF_LOGIN_REQUIRED
#define CKF_EC_UNCOMPRESS
#define CKA_SUB_PRIME_BITS
#define CKF_LIBRARY_CANT_CREATE_OS_THREADS
#define CKM_SEED_MAC_GENERAL
#define CKF_PROTECTED_AUTHENTICATION_PATH
#define CKA_HASH_OF_SUBJECT_PUBLIC_KEY
#define CKR_FUNCTION_CANCELED
#define CKM_DSA_PROBABLISTIC_PARAMETER_GEN
#define CKM_TWOFISH_CBC_PAD
#define CKM_SKIPJACK_CFB8
#define CKM_RSA_X9_31_KEY_PAIR_GEN
#define CKR_KEY_UNEXTRACTABLE
#define CKR_UNWRAPPING_KEY_HANDLE_INVALID
#define CKM_CONCATENATE_BASE_AND_KEY
#define CKR_NEED_TO_CREATE_THREADS
#define CKM_SEED_ECB_ENCRYPT_DATA
#define CKR_WRAPPING_KEY_SIZE_RANGE
#define CKM_FORTEZZA_TIMESTAMP
#define CKS_RW_PUBLIC_SESSION
#define CKR_MECHANISM_PARAM_INVALID
#define CKA_SUPPORTED_CMS_ATTRIBUTES
#define CKF_TOKEN_INITIALIZED
#define CKR_TOKEN_NOT_RECOGNIZED
#define CKM_SHA512_HMAC_GENERAL
#define CKM_SKIPJACK_CFB64
#define CKM_DES_CBC_ENCRYPT_DATA
#define CKD_SHA1_KDF_ASN1
#define CKR_ATTRIBUTE_SENSITIVE
#define CKM_ECDH1_COFACTOR_DERIVE
#define CKR_RANDOM_NO_RNG
#define CKM_ARIA_CBC_ENCRYPT_DATA
#define CKM_CAMELLIA_KEY_GEN
#define CKR_PIN_LEN_RANGE
#define CKF_USER_PIN_FINAL_TRY
#define CKM_BATON_KEY_GEN
#define CKA_PRIVATE_EXPONENT
#define CKR_RANDOM_SEED_NOT_SUPPORTED
#define CKR_SESSION_PARALLEL_NOT_SUPPORTED
#define CKM_VENDOR_DEFINED
#define CKR_ATTRIBUTE_READ_ONLY
#define CKR_KEY_FUNCTION_NOT_PERMITTED
#define CKA_HW_FEATURE_TYPE
#define CKM_TWOFISH_KEY_GEN
#define CKR_WRAPPING_KEY_TYPE_INCONSISTENT
#define CKA_VERIFY_RECOVER
#define CKM_SHA512_224_HMAC_GENERAL
#define CKM_SKIPJACK_RELAYX
#define CKM_SHA512_224_HMAC
#define CKR_SESSION_EXISTS
#define CKM_MD5_HMAC_GENERAL
#define CKR_FUNCTION_REJECTED
#define CKM_SHA_1_HMAC_GENERAL
#define CKM_TLS10_MAC_CLIENT
unsigned long int CK_ULONG
#define CKM_JUNIPER_ECB128
#define CKA_PUBLIC_EXPONENT
#define CKM_SKIPJACK_CBC64
#define CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE
#define CKM_PBE_SHA1_DES2_EDE_CBC
#define CKM_X9_42_DH_KEY_PAIR_GEN
#define CRYPTOKI_VERSION_MINOR
#define CKM_RSA_PKCS_KEY_PAIR_GEN
#define CKR_SESSION_READ_ONLY
#define CKA_OTP_TIME_REQUIREMENT
#define CKM_PBE_MD5_CAST5_CBC
#define CKM_KEA_KEY_DERIVE
#define CKC_X_509_ATTR_CERT
#define CKM_JUNIPER_KEY_GEN
#define CKR_ENCRYPTED_DATA_LEN_RANGE
#define CKM_SHA512_KEY_DERIVATION
#define CKA_BITS_PER_PIXEL
#define CKR_SIGNATURE_INVALID
#define CKM_AES_MAC_GENERAL
#define CKM_CAST128_CBC_PAD
#define CKA_OTP_USER_IDENTIFIER
#define CKR_SESSION_HANDLE_INVALID
#define CK_CERTIFICATE_CATEGORY_OTHER_ENTITY
#define CKF_USER_PIN_INITIALIZED
#define CKA_PUBLIC_KEY_INFO
#define CKA_OTP_USER_FRIENDLY_MODE
#define CKM_SHA384_HMAC_GENERAL
#define CKR_USER_ANOTHER_ALREADY_LOGGED_IN
#define CKM_SECURID_KEY_GEN
#define CKM_IDEA_MAC_GENERAL
#define CKS_RO_USER_FUNCTIONS
#define CKM_TLS_KEY_AND_MAC_DERIVE
#define CKM_GOST28147_ECB
#define CKR_ARGUMENTS_BAD
#define CKM_SHA512_224_KEY_DERIVATION
#define CKM_SHA512_T_HMAC_GENERAL
#define CKM_TLS_MASTER_KEY_DERIVE_DH
#define CKM_CAST3_MAC_GENERAL
#define CKM_CAST5_CBC_PAD
#define CKM_PBE_SHA1_RC2_128_CBC
#define CKA_NAME_HASH_ALGORITHM
#define CKM_SSL3_PRE_MASTER_KEY_GEN
#define CKM_SSL3_MASTER_KEY_DERIVE_DH
#define CKR_LIBRARY_LOAD_FAILED
#define CKM_RIPEMD128_HMAC_GENERAL
#define CKM_PBA_SHA1_WITH_SHA1_HMAC
#define CKA_OTP_SERVICE_LOGO_TYPE
CK_ULONG CK_SESSION_HANDLE
#define CKA_OTP_CHALLENGE_REQUIREMENT
#define CKR_TOKEN_NOT_PRESENT
#define CKM_SHA512_T_KEY_DERIVATION
#define CKR_CRYPTOKI_NOT_INITIALIZED
#define CKM_DH_PKCS_DERIVE
#define CKM_CAMELLIA_MAC_GENERAL
#define CKM_MD2_HMAC_GENERAL
#define CKM_SEED_CBC_ENCRYPT_DATA
#define CKM_DES3_CMAC_GENERAL
#define CKR_PIN_INCORRECT
#define CKM_CAST128_MAC_GENERAL
#define CK_CERTIFICATE_CATEGORY_TOKEN_USER
#define CKM_PBE_SHA1_RC4_40
#define CKM_PBE_SHA1_CAST5_CBC
#define CKM_TLS10_MAC_SERVER
#define CKM_X9_42_DH_DERIVE
#define CKF_GENERATE_KEY_PAIR
#define CKM_SKIPJACK_PRIVATE_WRAP
#define CKM_KEY_WRAP_LYNKS
#define CKM_SHA512_RSA_PKCS_PSS
#define CKM_CAST5_KEY_GEN
#define CKF_REMOVABLE_DEVICE
#define CKP_PKCS5_PBKD2_HMAC_SHA512_256
#define CKM_RSA_PKCS_OAEP
#define CKR_WRAPPED_KEY_INVALID
#define CKF_SECONDARY_AUTHENTICATION
#define CKM_PBE_SHA1_RC4_128
#define CKM_RSA_PKCS_OAEP_TPM_1_1
#define CKM_SHA512_RSA_PKCS
#define CKM_DES3_MAC_GENERAL
#define CKP_PKCS5_PBKD2_HMAC_SHA224
#define CKM_EXTRACT_KEY_FROM_KEY
#define CKM_SKIPJACK_CFB32
#define CKF_USER_FRIENDLY_OTP
#define CKR_WRAPPING_KEY_HANDLE_INVALID
#define CKR_MUTEX_NOT_LOCKED
#define CKR_USER_TOO_MANY_TYPES
#define CKM_CAST_MAC_GENERAL
#define CKF_USER_PIN_COUNT_LOW
#define CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC
#define CKR_SESSION_CLOSED
#define CKK_RIPEMD160_HMAC
#define CKM_DSA_KEY_PAIR_GEN
#define CKM_SHA1_RSA_X9_31
#define CKM_AES_CBC_ENCRYPT_DATA
#define CKM_CAMELLIA_CBC_PAD
#define CKF_EXCLUDE_COUNTER
CK_FUNCTION_LIST CK_PTR CK_FUNCTION_LIST_PTR
#define CKM_CAMELLIA_ECB_ENCRYPT_DATA
#define CKM_SKIPJACK_CFB16
#define CKM_WTLS_MASTER_KEY_DERIVE
#define CKM_SKIPJACK_KEY_GEN
#define CKH_MONOTONIC_COUNTER
#define CKF_OS_LOCKING_OK
#define CKM_GOST28147_KEY_WRAP
#define CKM_SHA224_RSA_PKCS_PSS
#define CKM_MD5_KEY_DERIVATION
#define CKP_PKCS5_PBKD2_HMAC_SHA384
#define CKR_OBJECT_HANDLE_INVALID
#define CKF_EC_ECPARAMETERS
#define CKM_KEA_KEY_PAIR_GEN
#define CKA_RESET_ON_INIT
#define CKA_OTP_PIN_REQUIREMENT
CK_ULONG CK_RSA_PKCS_MGF_TYPE
#define CKR_UNWRAPPING_KEY_SIZE_RANGE
#define CKM_X9_42_MQV_DERIVE
#define CKD_CPDIVERSIFY_KDF
#define CKM_TLS12_MASTER_KEY_DERIVE
#define CKM_BATON_SHUFFLE
#define CKM_SHA512_256_HMAC_GENERAL
#define CKM_RC5_MAC_GENERAL
#define CKR_ENCRYPTED_DATA_INVALID
#define CKP_PKCS5_PBKD2_HMAC_GOSTR3411
#define CKR_CRYPTOKI_ALREADY_INITIALIZED
#define CKM_GENERIC_SECRET_KEY_GEN
#define CKM_DH_PKCS_KEY_PAIR_GEN
#define CKM_DES3_ECB_ENCRYPT_DATA
#define CKA_ALLOWED_MECHANISMS
#define CKF_SERIAL_SESSION
#define CKR_FUNCTION_FAILED
#define CKM_CDMF_MAC_GENERAL
#define CKA_OTP_COUNTER_REQUIREMENT
#define CKF_DUAL_CRYPTO_OPERATIONS
#define CKR_OPERATION_NOT_INITIALIZED
#define CKR_ACTION_PROHIBITED
#define CKF_SO_PIN_TO_BE_CHANGED
#define CKR_SESSION_READ_ONLY_EXISTS
#define CKM_TLS_PRE_MASTER_KEY_GEN
#define CKM_EC_KEY_PAIR_GEN
#define CKR_SESSION_READ_WRITE_SO_EXISTS
#define CKR_KEY_SIZE_RANGE
#define CKM_DH_PKCS_PARAMETER_GEN
#define CKM_PBE_MD5_CAST128_CBC
#define CKR_TEMPLATE_INCONSISTENT
#define CKR_OPERATION_ACTIVE
#define CKR_DATA_LEN_RANGE
#define CKM_SHA1_RSA_PKCS
#define CKF_ARRAY_ATTRIBUTE
#define CKM_MD2_KEY_DERIVATION
#define CKM_DSA_SHAWE_TAYLOR_PARAMETER_GEN
#define CKA_WRAP_WITH_TRUSTED
CK_ULONG CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE
#define CKR_BUFFER_TOO_SMALL
#define CKM_ARIA_MAC_GENERAL
#define CKM_CAMELLIA_CBC_ENCRYPT_DATA
#define CKS_RW_USER_FUNCTIONS
#define CKM_AES_CMAC_GENERAL
#define CKS_RO_PUBLIC_SESSION
#define CKM_PBE_MD5_CAST_CBC
#define CKM_SHA1_KEY_DERIVATION
#define CKF_EXCLUDE_CHALLENGE
#define CKO_VENDOR_DEFINED
#define CKP_PKCS5_PBKD2_HMAC_SHA512
#define CKR_USER_PIN_NOT_INITIALIZED
#define CKA_ALWAYS_AUTHENTICATE
#define CKM_BATON_COUNTER
#define CKM_CAST3_KEY_GEN
#define CKM_JUNIPER_CBC128
#define CKM_SHA224_RSA_PKCS
#define CKM_PBE_SHA1_DES3_EDE_CBC
#define CKR_USER_ALREADY_LOGGED_IN
#define CKR_STATE_UNSAVEABLE
#define CKM_RIPEMD160_RSA_PKCS
#define CKP_PKCS5_PBKD2_HMAC_SHA1
#define CKA_GOST28147_PARAMS
#define CKM_X9_42_DH_PARAMETER_GEN
#define CKK_RIPEMD128_HMAC
#define CKM_JUNIPER_COUNTER
#define CKD_SHA1_KDF_CONCATENATE
#define CKM_SHA512_256_HMAC
CK_ULONG CK_MECHANISM_TYPE
#define CKK_GENERIC_SECRET
#define CKM_TLS12_KEY_SAFE_DERIVE
#define CKM_PBE_SHA1_CAST128_CBC
#define CKU_CONTEXT_SPECIFIC
#define CKP_PKCS5_PBKD2_HMAC_SHA512_224
#define CKF_SO_PIN_FINAL_TRY
#define CKR_INFORMATION_SENSITIVE
#define CKM_AES_KEY_WRAP_PAD
#define CKM_CONCATENATE_DATA_AND_BASE
#define CKM_GOSTR3410_KEY_WRAP
#define CKM_XOR_BASE_AND_DATA
#define CKM_GOST28147_KEY_GEN
#define CKR_ATTRIBUTE_VALUE_INVALID
#define CKA_REQUIRED_CMS_ATTRIBUTES
#define CK_CERTIFICATE_CATEGORY_AUTHORITY
#define CKM_PBE_MD2_DES_CBC
#define CKM_RIPEMD160_HMAC
#define CKM_KEY_WRAP_SET_OAEP
#define CKM_CAST3_CBC_PAD
#define CKA_CERTIFICATE_CATEGORY
#define CKK_VENDOR_DEFINED
#define CKR_FUNCTION_NOT_SUPPORTED
#define CKF_RESTORE_KEY_NOT_NEEDED
#define CKA_GOSTR3410_PARAMS
#define CKR_USER_NOT_LOGGED_IN
#define CKA_ALWAYS_SENSITIVE
#define CKM_DES_ECB_ENCRYPT_DATA
#define CKR_DEVICE_REMOVED
#define CKA_VENDOR_DEFINED
#define CKM_PBE_SHA1_RC2_40_CBC
#define CKM_GOSTR3410_DERIVE
#define CKP_PKCS5_PBKD2_HMAC_SHA256
#define CKM_SHA256_HMAC_GENERAL
#define CKF_USER_PIN_TO_BE_CHANGED
#define CKM_AES_ECB_ENCRYPT_DATA
#define CKM_RIPEMD128_RSA_PKCS
#define CK_CERTIFICATE_CATEGORY_UNSPECIFIED
#define CKR_DOMAIN_PARAMS_INVALID
#define CKA_CERTIFICATE_TYPE
#define CKF_SO_PIN_LOCKED
CK_ULONG CK_CERTIFICATE_TYPE
#define CKR_TOKEN_WRITE_PROTECTED
#define CKA_HASH_OF_ISSUER_PUBLIC_KEY
#define CKH_VENDOR_DEFINED
#define CKM_RIPEMD128_HMAC
#define CKR_TEMPLATE_INCOMPLETE
#define CKM_DES3_CBC_ENCRYPT_DATA
#define CKF_SO_PIN_COUNT_LOW
CK_ULONG CK_OBJECT_HANDLE
#define CKA_ENCODING_METHODS
CK_ULONG CK_HW_FEATURE_TYPE
#define CKM_SHA256_RSA_PKCS_PSS
#define CKR_KEY_NOT_NEEDED
#define CKM_SKIPJACK_WRAP
#define CKR_VENDOR_DEFINED
#define CKM_SKIPJACK_ECB64
#define CKM_SHA384_KEY_DERIVATION
#define CKA_SUBPRIME_BITS
#define CKM_SKIPJACK_OFB64
#define CKM_GOSTR3410_WITH_GOSTR3411
#define CKM_SHA1_RSA_PKCS_PSS
#define CKM_GOSTR3410_KEY_PAIR_GEN
#define CKA_DEFAULT_CMS_ATTRIBUTES
#define CKM_SHA512_256_KEY_DERIVATION
#define CKA_GOSTR3411_PARAMS
#define CKM_SHA384_RSA_PKCS
CK_ULONG CK_ATTRIBUTE_TYPE
#define CKR_FUNCTION_NOT_PARALLEL
#define CKA_UNWRAP_TEMPLATE
#define CKR_SIGNATURE_LEN_RANGE
#define CKR_CURVE_NOT_SUPPORTED
#define CKM_SHA224_KEY_DERIVATION
#define CKA_KEY_GEN_MECHANISM
#define CKR_FIPS_SELF_TEST_FAILED
#define CKM_JUNIPER_SHUFFLE
#define CKR_USER_TYPE_INVALID
#define CKM_ECDH_AES_KEY_WRAP
#define CRYPTOKI_VERSION_MAJOR
#define CKO_DOMAIN_PARAMETERS
#define CKM_PBE_MD5_CAST3_CBC
#define CKM_RSA_AES_KEY_WRAP
#define CKF_USER_PIN_LOCKED
#define CKM_PBE_MD5_DES_CBC
#define CKM_SHA512_T_HMAC
#define CKM_RIPEMD160_HMAC_GENERAL
#define CKM_SHA256_RSA_PKCS
#define CKR_KEY_HANDLE_INVALID
#define CKM_RC2_MAC_GENERAL
#define CKM_CAST128_KEY_GEN
#define CKF_TOKEN_PRESENT
#define CKM_SHA384_RSA_PKCS_PSS
#define CKM_RSA_PKCS_TPM_1_1
#define CKM_SSL3_KEY_AND_MAC_DERIVE
#define CKM_DES_MAC_GENERAL
#define CKR_SAVED_STATE_INVALID
#define CKM_ARIA_ECB_ENCRYPT_DATA
#define CKA_WRAP_TEMPLATE
#define CKR_WRAPPED_KEY_LEN_RANGE
#define CKM_X9_42_DH_HYBRID_DERIVE
#define CKR_EXCEEDED_MAX_ITERATIONS
#define CKM_BLOWFISH_KEY_GEN
#define CKM_GOST28147_MAC
#define CKR_KEY_INDIGESTIBLE
#define CKH_USER_INTERFACE
#define CKF_VERIFY_RECOVER
#define CKA_MECHANISM_TYPE
#define CKF_CLOCK_ON_TOKEN
#define CKS_RW_SO_FUNCTIONS
#define CKM_BLOWFISH_CBC_PAD
#define CKR_PUBLIC_KEY_INVALID
#define CKR_KEY_TYPE_INCONSISTENT
#define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT
#define CKM_AES_XCBC_MAC_96
#define CKM_ECDSA_KEY_PAIR_GEN
#define CKF_WRITE_PROTECTED
#define CKM_TLS12_KEY_AND_MAC_DERIVE
#define CKR_KEY_NOT_WRAPPABLE
#define CKA_DERIVE_TEMPLATE
#define CKF_EC_NAMEDCURVE
#define CKM_TLS12_MASTER_KEY_DERIVE_DH
#define CKM_SHA224_HMAC_GENERAL
#define CKA_OTP_SERVICE_LOGO