12#include <botan/exceptn.h>
13#include <botan/secmem.h>
22 #define CK_DECLARE_FUNCTION(returnType, name) returnType __declspec(dllimport) name
24 #define CK_DECLARE_FUNCTION(returnType, name) returnType name
28 #define CK_DECLARE_FUNCTION_POINTER(returnType, name) returnType __declspec(dllimport)(*name)
30 #define CK_DECLARE_FUNCTION_POINTER(returnType, name) returnType(*name)
33#define CK_CALLBACK_FUNCTION(returnType, name) returnType(*name)
36 #define NULL_PTR nullptr
40 #pragma pack(push, cryptoki, 1)
46 #pragma pack(pop, cryptoki)
51 "The Botan PKCS#11 module was implemented against PKCS#11 v2.40. Please use the correct PKCS#11 headers.");
55class Dynamically_Loaded_Library;
954 bool C_GetSlotList(
Bbool token_present,
971 bool C_GetSlotList(
bool token_present,
972 std::vector<SlotId>& slot_ids,
1037 bool C_GetMechanismList(
SlotId slot_id,
1056 bool C_GetMechanismList(
SlotId slot_id,
1057 std::vector<MechanismType>& mechanisms,
1075 bool C_GetMechanismInfo(
SlotId slot_id,
1097 bool C_InitToken(
SlotId slot_id,
1119 template <
typename TAlloc>
1121 const std::vector<uint8_t, TAlloc>& so_pin,
1122 std::string_view label,
1124 std::string padded_label(label);
1125 if(label.size() < 32) {
1126 padded_label.insert(padded_label.end(), 32 - label.size(),
' ');
1129 return C_InitToken(slot_id,
1130 reinterpret_cast<Utf8Char*
>(
const_cast<uint8_t*
>(so_pin.data())),
1131 static_cast<Ulong>(so_pin.size()),
1132 reinterpret_cast<Utf8Char*
>(
const_cast<char*
>(padded_label.c_str())),
1172 template <
typename TAlloc>
1174 const std::vector<uint8_t, TAlloc>& pin,
1176 return C_InitPIN(session,
1177 reinterpret_cast<Utf8Char*
>(
const_cast<uint8_t*
>(pin.data())),
1178 static_cast<Ulong>(pin.size()),
1223 template <
typename TAlloc>
1225 const std::vector<uint8_t, TAlloc>& old_pin,
1226 const std::vector<uint8_t, TAlloc>& new_pin,
1228 return C_SetPIN(session,
1229 reinterpret_cast<Utf8Char*
>(
const_cast<uint8_t*
>(old_pin.data())),
1230 static_cast<Ulong>(old_pin.size()),
1231 reinterpret_cast<Utf8Char*
>(
const_cast<uint8_t*
>(new_pin.data())),
1232 static_cast<Ulong>(new_pin.size()),
1256 bool C_OpenSession(
SlotId slot_id,
1324 Byte* operation_state_ptr,
1325 Ulong* operation_state_len_ptr,
1346 Byte* operation_state_ptr,
1347 Ulong operation_state_len,
1393 template <
typename TAlloc>
1396 const std::vector<uint8_t, TAlloc>& pin,
1398 return C_Login(session,
1400 reinterpret_cast<Utf8Char*
>(
const_cast<uint8_t*
>(pin.data())),
1401 static_cast<Ulong>(pin.size()),
1547 template <
typename TAlloc>
1550 std::map<
AttributeType, std::vector<uint8_t, TAlloc>>& attribute_values,
1552 std::vector<Attribute> getter_template;
1554 for(
const auto& entry : attribute_values) {
1558 bool success = C_GetAttributeValue(session,
1560 const_cast<Attribute*
>(getter_template.data()),
1561 static_cast<Ulong>(getter_template.size()),
1569 for(
auto& entry : attribute_values) {
1570 entry.second.clear();
1571 entry.second.resize(getter_template.at(i).ulValueLen);
1572 getter_template.at(i).pValue =
const_cast<uint8_t*
>(entry.second.data());
1576 return C_GetAttributeValue(session,
1578 const_cast<Attribute*
>(getter_template.data()),
1579 static_cast<Ulong>(getter_template.size()),
1624 template <
typename TAlloc>
1627 std::map<
AttributeType, std::vector<uint8_t, TAlloc>>& attribute_values,
1629 std::vector<Attribute> setter_template;
1631 for(
auto& entry : attribute_values) {
1633 entry.second.data(),
1634 static_cast<CK_ULONG>(entry.second.size())});
1637 return C_SetAttributeValue(session,
1639 const_cast<Attribute*
>(setter_template.data()),
1640 static_cast<Ulong>(setter_template.size()),
1681 Ulong max_object_count,
1682 Ulong* object_count_ptr,
1744 Byte* encrypted_data,
1745 Ulong* encrypted_data_len_ptr,
1764 template <
typename TAllocA,
typename TAllocB>
1766 const std::vector<uint8_t, TAllocA>& plaintext_data,
1767 std::vector<uint8_t, TAllocB>& encrypted_data,
1769 Ulong encrypted_size = 0;
1770 if(!C_Encrypt(session,
1771 const_cast<Byte*
>((plaintext_data.data())),
1772 static_cast<Ulong>(plaintext_data.size()),
1779 encrypted_data.resize(encrypted_size);
1780 if(!C_Encrypt(session,
1781 const_cast<Byte*
>(plaintext_data.data()),
1782 static_cast<Ulong>(plaintext_data.size()),
1783 encrypted_data.data(),
1788 encrypted_data.resize(encrypted_size);
1812 Byte* encrypted_part_ptr,
1813 Ulong* encrypted_part_len_ptr,
1832 Byte* last_encrypted_part_ptr,
1833 Ulong* last_encrypted_part_len_ptr,
1879 Byte* encrypted_data_ptr,
1880 Ulong encrypted_data_len,
1882 Ulong* data_len_ptr,
1901 template <
typename TAllocA,
typename TAllocB>
1903 const std::vector<uint8_t, TAllocA>& encrypted_data,
1904 std::vector<uint8_t, TAllocB>& decrypted_data,
1906 Ulong decrypted_size = 0;
1907 if(!C_Decrypt(session,
1908 const_cast<Byte*
>((encrypted_data.data())),
1909 static_cast<Ulong>(encrypted_data.size()),
1916 decrypted_data.resize(decrypted_size);
1917 if(!C_Decrypt(session,
1918 const_cast<Byte*
>(encrypted_data.data()),
1919 static_cast<Ulong>(encrypted_data.size()),
1920 decrypted_data.data(),
1925 decrypted_data.resize(decrypted_size);
1948 Byte* encrypted_part_ptr,
1949 Ulong encrypted_part_len,
1951 Ulong* part_len_ptr,
1971 Byte* last_part_ptr,
1972 Ulong* last_part_len_ptr,
2017 Ulong* digest_len_ptr,
2073 Ulong* digest_len_ptr,
2119 const Byte* data_ptr,
2121 Byte* signature_ptr,
2122 Ulong* signature_len_ptr,
2141 template <
typename TAllocA,
typename TAllocB>
2143 const std::vector<uint8_t, TAllocA>& data,
2144 std::vector<uint8_t, TAllocB>& signature,
2146 Ulong signature_size = 0;
2147 if(!C_Sign(session, data.data(),
static_cast<Ulong>(data.size()),
nullptr, &signature_size, return_value)) {
2151 signature.resize(signature_size);
2154 static_cast<Ulong>(data.size()),
2160 signature.resize(signature_size);
2180 const Byte* part_ptr,
2198 template <
typename TAlloc>
2200 const std::vector<uint8_t, TAlloc>& part,
2202 return C_SignUpdate(session, part.data(),
static_cast<Ulong>(part.size()), return_value);
2222 Byte* signature_ptr,
2223 Ulong* signature_len_ptr,
2241 template <
typename TAlloc>
2243 std::vector<uint8_t, TAlloc>& signature,
2245 Ulong signature_size = 0;
2246 if(!C_SignFinal(session,
nullptr, &signature_size, return_value)) {
2250 signature.resize(signature_size);
2251 if(!C_SignFinal(session, signature.data(), &signature_size, return_value)) {
2254 signature.resize(signature_size);
2301 Byte* signature_ptr,
2302 Ulong* signature_len_ptr,
2348 const Byte* data_ptr,
2350 const Byte* signature_ptr,
2351 Ulong signature_len,
2370 template <
typename TAllocA,
typename TAllocB>
2372 const std::vector<uint8_t, TAllocA>& data,
2373 std::vector<uint8_t, TAllocB>& signature,
2375 return C_Verify(session,
2377 static_cast<Ulong>(data.size()),
2379 static_cast<Ulong>(signature.size()),
2399 const Byte* part_ptr,
2417 template <
typename TAlloc>
2419 std::vector<uint8_t, TAlloc> part,
2421 return C_VerifyUpdate(session, part.data(),
static_cast<Ulong>(part.size()), return_value);
2441 const Byte* signature_ptr,
2442 Ulong signature_len,
2486 Byte* signature_ptr,
2487 Ulong signature_len,
2489 Ulong* data_len_ptr,
2514 Byte* encrypted_part_ptr,
2515 Ulong* encrypted_part_len_ptr,
2537 Byte* encrypted_part_ptr,
2538 Ulong encrypted_part_len,
2540 Ulong* part_len_ptr,
2564 Byte* encrypted_part_ptr,
2565 Ulong* encrypted_part_len_ptr,
2587 Byte* encrypted_part_ptr,
2588 Ulong encrypted_part_len,
2590 Ulong* part_len_ptr,
2650 Ulong public_key_attribute_count,
2652 Ulong private_key_attribute_count,
2683 Byte* wrapped_key_ptr,
2684 Ulong* wrapped_key_len_ptr,
2716 Byte* wrapped_key_ptr,
2717 Ulong wrapped_key_len,
2719 Ulong attribute_count,
2750 Ulong attribute_count,
2773 const Byte* seed_ptr,
2793 Byte* random_data_ptr,
2841 static bool handle_return_value(
CK_RV function_result,
ReturnValue* return_value);
2857 PKCS11_Error(std::to_string(static_cast<uint32_t>(return_val))), m_return_val(return_val) {}
2861 int error_code() const noexcept
override {
return static_cast<int>(m_return_val); }
Provides access to all PKCS#11 functions.
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_InitToken(SlotId slot_id, const std::vector< uint8_t, TAlloc > &so_pin, std::string_view label, ReturnValue *return_value=ThrowException) const
bool C_Login(SessionHandle session, UserType user_type, const std::vector< uint8_t, TAlloc > &pin, 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_Verify(SessionHandle session, const std::vector< uint8_t, TAllocA > &data, std::vector< uint8_t, TAllocB > &signature, 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_VerifyUpdate(SessionHandle session, std::vector< uint8_t, TAlloc > part, ReturnValue *return_value=ThrowException) const
bool C_SignFinal(SessionHandle session, std::vector< uint8_t, TAlloc > &signature, ReturnValue *return_value=ThrowException) const
FunctionListPtr get_functions() 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)
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)
CK_DESTROYMUTEX DestroyMutex
@ Pkcs5Pbkd2HmacSha512256
@ Pkcs5Pbkd2HmacGostr3411
@ Pkcs5Pbkd2HmacSha512224
ReturnValue * ThrowException
CK_CREATEMUTEX CreateMutex
secure_vector< uint8_t > secure_string
@ OtpChallengeRequirement
void change_pin(Slot &slot, const secure_string &old_pin, const secure_string &new_pin)
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)
void set_pin(Slot &slot, const secure_string &so_pin, const secure_string &pin)
@ 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
#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
struct CK_SLOT_INFO CK_SLOT_INFO
#define CKM_TLS_KEY_AND_MAC_DERIVE
#define CKM_GOST28147_ECB
#define CKR_ARGUMENTS_BAD
struct CK_TOKEN_INFO CK_TOKEN_INFO
#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
struct CK_ATTRIBUTE CK_ATTRIBUTE
#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
struct CK_MECHANISM_INFO CK_MECHANISM_INFO
#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
struct CK_SESSION_INFO CK_SESSION_INFO
#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
struct CK_RSA_PKCS_PSS_PARAMS CK_RSA_PKCS_PSS_PARAMS
#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
struct CK_C_INITIALIZE_ARGS CK_C_INITIALIZE_ARGS
struct CK_MECHANISM CK_MECHANISM
#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
struct CK_ECDH1_DERIVE_PARAMS CK_ECDH1_DERIVE_PARAMS
#define CKM_SHA224_HMAC_GENERAL
struct CK_RSA_PKCS_OAEP_PARAMS CK_RSA_PKCS_OAEP_PARAMS
#define CKA_OTP_SERVICE_LOGO