12 #include <botan/secmem.h>
13 #include <botan/exceptn.h>
14 #include <botan/dyn_load.h>
23 #define CK_DECLARE_FUNCTION(returnType, name) \
24 returnType __declspec(dllimport) name
26 #define CK_DECLARE_FUNCTION(returnType, name) \
31 #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \
32 returnType __declspec(dllimport) (* name)
34 #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \
38 #define CK_CALLBACK_FUNCTION(returnType, name) \
42 #define NULL_PTR nullptr
46 #pragma pack(push, cryptoki, 1)
52 #pragma pack(pop, cryptoki)
56 "The Botan PKCS#11 module was implemented against PKCS#11 v2.40. Please use the correct PKCS#11 headers.");
267 return static_cast< Flag >(
static_cast< CK_FLAGS >(a) | static_cast< CK_FLAGS >(b));
920 bool C_Initialize(
VoidPtr init_args,
933 bool C_Finalize(
VoidPtr reserved,
946 bool C_GetInfo(
Info* info_ptr,
978 bool C_GetSlotList(
Bbool token_present,
995 bool C_GetSlotList(
bool token_present,
996 std::vector<SlotId>& slot_ids,
1011 bool C_GetSlotInfo(
SlotId slot_id,
1013 ReturnValue* return_value = ThrowException)
const;
1028 bool C_GetTokenInfo(
SlotId slot_id,
1030 ReturnValue* return_value = ThrowException)
const;
1048 ReturnValue* return_value = ThrowException)
const;
1065 bool C_GetMechanismList(
SlotId slot_id,
1068 ReturnValue* return_value = ThrowException)
const;
1084 bool C_GetMechanismList(
SlotId slot_id,
1085 std::vector<MechanismType>& mechanisms,
1086 ReturnValue* return_value = ThrowException)
const;
1103 bool C_GetMechanismInfo(
SlotId slot_id,
1106 ReturnValue* return_value = ThrowException)
const;
1125 bool C_InitToken(
SlotId slot_id,
1129 ReturnValue* return_value = ThrowException)
const;
1147 template<
typename TAlloc>
1149 const std::vector<uint8_t, TAlloc>& so_pin,
1150 const std::string& label,
1153 std::string padded_label = label;
1154 if(label.size() < 32)
1156 padded_label.insert(padded_label.end(), 32 - label.size(),
' ');
1159 return C_InitToken(slot_id, reinterpret_cast< Utf8Char* >(const_cast< uint8_t* >(so_pin.data())),
1160 so_pin.size(),
reinterpret_cast< Utf8Char*
>(
const_cast< char*
>(padded_label.c_str())), return_value);
1182 ReturnValue* return_value = ThrowException)
const;
1199 template<
typename TAlloc>
1201 const std::vector<uint8_t, TAlloc>& pin,
1204 return C_InitPIN(session, reinterpret_cast< Utf8Char* >(const_cast< uint8_t* >(pin.data())), pin.size(), return_value);
1230 ReturnValue* return_value = ThrowException)
const;
1248 template<
typename TAlloc>
1250 const std::vector<uint8_t, TAlloc>& old_pin,
1251 const std::vector<uint8_t, TAlloc>& new_pin,
1254 return C_SetPIN(session,
1255 reinterpret_cast< Utf8Char* >(const_cast< uint8_t* >(old_pin.data())), old_pin.size(),
1256 reinterpret_cast< Utf8Char*
>(
const_cast< uint8_t*
>(new_pin.data())), new_pin.size(),
1281 bool C_OpenSession(
SlotId slot_id,
1286 ReturnValue* return_value = ThrowException)
const;
1301 ReturnValue* return_value = ThrowException)
const;
1315 bool C_CloseAllSessions(
SlotId slot_id,
1316 ReturnValue* return_value = ThrowException)
const;
1333 ReturnValue* return_value = ThrowException)
const;
1351 Byte* operation_state_ptr,
1352 Ulong* operation_state_len_ptr,
1353 ReturnValue* return_value = ThrowException)
const;
1373 Byte* operation_state_ptr,
1374 Ulong operation_state_len,
1377 ReturnValue* return_value = ThrowException)
const;
1401 ReturnValue* return_value = ThrowException)
const;
1420 template<
typename TAlloc>
1423 const std::vector<uint8_t, TAlloc>& pin,
1426 return C_Login(session, user_type, reinterpret_cast< Utf8Char* >(const_cast< uint8_t* >(pin.data())), pin.size(),
1443 ReturnValue* return_value = ThrowException)
const;
1470 ReturnValue* return_value = ThrowException)
const;
1496 ReturnValue* return_value = ThrowException)
const;
1514 ReturnValue* return_value = ThrowException)
const;
1534 ReturnValue* return_value = ThrowException)
const;
1556 ReturnValue* return_value = ThrowException)
const;
1573 template<
typename TAlloc>
1576 std::map<
AttributeType, std::vector<uint8_t, TAlloc>>& attribute_values,
1579 std::vector<Attribute> getter_template;
1581 for(
const auto& entry : attribute_values)
1586 bool success = C_GetAttributeValue(session,
object, const_cast< Attribute* >(getter_template.data()),
1587 getter_template.size(), return_value);
1595 for(
auto& entry : attribute_values)
1597 entry.second.clear();
1598 entry.second.resize(getter_template.at(i).ulValueLen);
1599 getter_template.at(i).pValue =
const_cast< uint8_t*
>(entry.second.data());
1603 return C_GetAttributeValue(session,
object, const_cast< Attribute* >(getter_template.data()), getter_template.size(),
1629 ReturnValue* return_value = ThrowException)
const;
1648 template<
typename TAlloc>
1651 std::map<
AttributeType, std::vector<uint8_t, TAlloc>>& attribute_values,
1654 std::vector<Attribute> setter_template;
1656 for(
auto& entry : attribute_values)
1661 return C_SetAttributeValue(session,
object, const_cast< Attribute* >(setter_template.data()), setter_template.size(),
1683 ReturnValue* return_value = ThrowException)
const;
1702 Ulong max_object_count,
1703 Ulong* object_count_ptr,
1704 ReturnValue* return_value = ThrowException)
const;
1719 ReturnValue* return_value = ThrowException)
const;
1743 ReturnValue* return_value = ThrowException)
const;
1766 Byte* encrypted_data,
1767 Ulong* encrypted_data_len_ptr,
1768 ReturnValue* return_value = ThrowException)
const;
1786 template<
typename TAllocA,
typename TAllocB>
1788 const std::vector<uint8_t, TAllocA>& plaintext_data,
1789 std::vector<uint8_t, TAllocB>& encrypted_data,
1792 Ulong encrypted_size = 0;
1793 if(!C_Encrypt(session, const_cast<Byte*>((plaintext_data.data())), plaintext_data.size(),
nullptr, &encrypted_size,
1799 encrypted_data.resize(encrypted_size);
1800 return C_Encrypt(session, const_cast<Byte*>(plaintext_data.data()), plaintext_data.size(), encrypted_data.data(),
1801 &encrypted_size, return_value);
1824 Byte* encrypted_part_ptr,
1825 Ulong* encrypted_part_len_ptr,
1826 ReturnValue* return_value = ThrowException)
const;
1844 Byte* last_encrypted_part_ptr,
1845 Ulong* last_encrypted_part_len_ptr,
1846 ReturnValue* return_value = ThrowException)
const;
1870 ReturnValue* return_value = ThrowException)
const;
1891 Byte* encrypted_data_ptr,
1892 Ulong encrypted_data_len,
1894 Ulong* data_len_ptr,
1895 ReturnValue* return_value = ThrowException)
const;
1913 template<
typename TAllocA,
typename TAllocB>
1915 const std::vector<uint8_t, TAllocA>& encrypted_data,
1916 std::vector<uint8_t, TAllocB>& decrypted_data,
1919 Ulong decrypted_size = 0;
1920 if(!C_Decrypt(session, const_cast<Byte*>((encrypted_data.data())), encrypted_data.size(),
nullptr, &decrypted_size,
1926 decrypted_data.resize(decrypted_size);
1927 return C_Decrypt(session, const_cast<Byte*>(encrypted_data.data()), encrypted_data.size(), decrypted_data.data(),
1928 &decrypted_size, return_value);
1950 Byte* encrypted_part_ptr,
1951 Ulong encrypted_part_len,
1953 Ulong* part_len_ptr,
1954 ReturnValue* return_value = ThrowException)
const;
1973 Byte* last_part_ptr,
1974 Ulong* last_part_len_ptr,
1975 ReturnValue* return_value = ThrowException)
const;
1996 ReturnValue* return_value = ThrowException)
const;
2019 Ulong* digest_len_ptr,
2020 ReturnValue* return_value = ThrowException)
const;
2040 ReturnValue* return_value = ThrowException)
const;
2058 ReturnValue* return_value = ThrowException)
const;
2077 Ulong* digest_len_ptr,
2078 ReturnValue* return_value = ThrowException)
const;
2102 ReturnValue* return_value = ThrowException)
const;
2125 Byte* signature_ptr,
2126 Ulong* signature_len_ptr,
2127 ReturnValue* return_value = ThrowException)
const;
2145 template<
typename TAllocA,
typename TAllocB>
2147 const std::vector<uint8_t, TAllocA>& data,
2148 std::vector<uint8_t, TAllocB>& signature,
2151 Ulong signature_size = 0;
2152 if(!C_Sign(session, const_cast<Byte*>((data.data())), data.size(),
nullptr, &signature_size, return_value))
2157 signature.resize(signature_size);
2158 return C_Sign(session, const_cast<Byte*>(data.data()), data.size(), signature.data(), &signature_size, return_value);
2179 ReturnValue* return_value = ThrowException)
const;
2195 template<
typename TAlloc>
2197 const std::vector<uint8_t, TAlloc>& part,
2200 return C_SignUpdate(session, const_cast<Byte*>(part.data()), part.size(), return_value);
2220 Byte* signature_ptr,
2221 Ulong* signature_len_ptr,
2222 ReturnValue* return_value = ThrowException)
const;
2239 template<
typename TAlloc>
2241 std::vector<uint8_t, TAlloc>& signature,
2244 Ulong signature_size = 0;
2245 if(!C_SignFinal(session,
nullptr, &signature_size, return_value))
2250 signature.resize(signature_size);
2251 return C_SignFinal(session, signature.data(), &signature_size, return_value);
2274 ReturnValue* return_value = ThrowException)
const;
2297 Byte* signature_ptr,
2298 Ulong* signature_len_ptr,
2299 ReturnValue* return_value = ThrowException)
const;
2323 ReturnValue* return_value = ThrowException)
const;
2346 Byte* signature_ptr,
2347 Ulong signature_len,
2348 ReturnValue* return_value = ThrowException)
const;
2366 template<
typename TAllocA,
typename TAllocB>
2368 const std::vector<uint8_t, TAllocA>& data,
2369 std::vector<uint8_t, TAllocB>& signature,
2372 return C_Verify(session, const_cast<Byte*>(data.data()), data.size(), signature.data(), signature.size(), return_value);
2393 ReturnValue* return_value = ThrowException)
const;
2409 template<
typename TAlloc>
2411 std::vector<uint8_t, TAlloc> part,
2414 return C_VerifyUpdate(session, part.data(), part.size(), return_value);
2434 Byte* signature_ptr,
2435 Ulong signature_len,
2436 ReturnValue* return_value = ThrowException)
const;
2458 ReturnValue* return_value = ThrowException)
const;
2479 Byte* signature_ptr,
2480 Ulong signature_len,
2482 Ulong* data_len_ptr,
2483 ReturnValue* return_value = ThrowException)
const;
2507 Byte* encrypted_part_ptr,
2508 Ulong* encrypted_part_len_ptr,
2509 ReturnValue* return_value = ThrowException)
const ;
2530 Byte* encrypted_part_ptr,
2531 Ulong encrypted_part_len,
2533 Ulong* part_len_ptr,
2534 ReturnValue* return_value = ThrowException)
const;
2557 Byte* encrypted_part_ptr,
2558 Ulong* encrypted_part_len_ptr,
2559 ReturnValue* return_value = ThrowException)
const;
2580 Byte* encrypted_part_ptr,
2581 Ulong encrypted_part_len,
2583 Ulong* part_len_ptr,
2584 ReturnValue* return_value = ThrowException)
const;
2614 ReturnValue* return_value = ThrowException)
const;
2643 Ulong public_key_attribute_count,
2645 Ulong private_key_attribute_count,
2648 ReturnValue* return_value = ThrowException)
const;
2676 Byte* wrapped_key_ptr,
2677 Ulong* wrapped_key_len_ptr,
2678 ReturnValue* return_value = ThrowException)
const;
2709 Byte* wrapped_key_ptr,
2710 Ulong wrapped_key_len,
2712 Ulong attribute_count,
2714 ReturnValue* return_value = ThrowException)
const;
2743 Ulong attribute_count,
2745 ReturnValue* return_value = ThrowException)
const;
2768 ReturnValue* return_value = ThrowException)
const;
2786 Byte* random_data_ptr,
2788 ReturnValue* return_value = ThrowException)
const;
2804 ReturnValue* return_value = ThrowException)
const;
2818 ReturnValue* return_value = ThrowException)
const;
2838 m_return_val(return_val)
2843 return m_return_val;
#define CKF_EXCLUDE_COUNTER
#define CKM_DES3_CBC_ENCRYPT_DATA
struct CK_RSA_PKCS_OAEP_PARAMS CK_RSA_PKCS_OAEP_PARAMS
#define CKP_PKCS5_PBKD2_HMAC_SHA512
#define CKF_EC_NAMEDCURVE
#define CKM_SHA512_RSA_PKCS_PSS
#define CKR_RANDOM_SEED_NOT_SUPPORTED
#define CKR_DEVICE_REMOVED
#define CKM_DSA_PARAMETER_GEN
#define CKM_AES_CMAC_GENERAL
#define CKM_SHA_1_HMAC_GENERAL
#define CKR_FIPS_SELF_TEST_FAILED
#define CKM_XOR_BASE_AND_DATA
#define CKF_USER_PIN_INITIALIZED
#define CKA_HW_FEATURE_TYPE
#define CKM_SHA384_KEY_DERIVATION
#define CKM_TLS_PRE_MASTER_KEY_GEN
Flag operator|(Flag a, Flag b)
#define CKM_RIPEMD128_HMAC_GENERAL
#define CKR_ENCRYPTED_DATA_INVALID
#define CKM_PBE_MD5_CAST_CBC
#define CKH_MONOTONIC_COUNTER
#define CKA_ENCODING_METHODS
#define CKH_USER_INTERFACE
#define CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC
#define CKA_WRAP_WITH_TRUSTED
#define CKR_SAVED_STATE_INVALID
#define CKM_KEY_WRAP_LYNKS
#define CKA_PRIVATE_EXPONENT
#define CKM_SHA512_RSA_PKCS
#define CKM_SHA224_RSA_PKCS
#define CKM_SEED_CBC_ENCRYPT_DATA
#define CKF_TOKEN_PRESENT
#define CKM_GOSTR3410_WITH_GOSTR3411
CK_UNLOCKMUTEX UnlockMutex
#define CKM_CAMELLIA_MAC_GENERAL
ReturnValue * ThrowException
#define CKM_PBE_SHA1_RC2_128_CBC
#define CKA_UNWRAP_TEMPLATE
#define CKA_OTP_SERVICE_LOGO_TYPE
#define CKF_EC_ECPARAMETERS
#define CKM_DES3_CMAC_GENERAL
#define CKD_SHA1_KDF_CONCATENATE
#define CKF_PROTECTED_AUTHENTICATION_PATH
#define CKK_VENDOR_DEFINED
#define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT
#define CKF_GENERATE_KEY_PAIR
CK_ULONG CK_MECHANISM_TYPE
#define CKM_ARIA_ECB_ENCRYPT_DATA
#define CKM_PBE_MD5_CAST5_CBC
#define CKU_CONTEXT_SPECIFIC
#define CKS_RW_USER_FUNCTIONS
#define CKM_SEED_ECB_ENCRYPT_DATA
#define CKM_SKIPJACK_CFB8
#define CKA_OTP_COUNTER_REQUIREMENT
#define CKA_REQUIRED_CMS_ATTRIBUTES
#define CKR_SIGNATURE_INVALID
#define CKR_FUNCTION_CANCELED
#define CKM_PBA_SHA1_WITH_SHA1_HMAC
#define CK_CERTIFICATE_CATEGORY_OTHER_ENTITY
#define CKM_JUNIPER_COUNTER
#define CKF_LIBRARY_CANT_CREATE_OS_THREADS
#define CKM_CAMELLIA_CBC_ENCRYPT_DATA
bool C_Sign(SessionHandle session, const std::vector< uint8_t, TAllocA > &data, std::vector< uint8_t, TAllocB > &signature, ReturnValue *return_value=ThrowException) const
#define CKM_CAST3_KEY_GEN
struct CK_TOKEN_INFO CK_TOKEN_INFO
#define CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE
#define CKM_SKIPJACK_WRAP
#define CKM_RSA_PKCS_TPM_1_1
#define CK_CERTIFICATE_CATEGORY_AUTHORITY
#define CKR_ATTRIBUTE_SENSITIVE
#define CKM_RSA_PKCS_KEY_PAIR_GEN
#define CKM_SKIPJACK_KEY_GEN
bool C_SignUpdate(SessionHandle session, const std::vector< uint8_t, TAlloc > &part, ReturnValue *return_value=ThrowException) const
#define CKM_CAMELLIA_ECB_ENCRYPT_DATA
#define CRYPTOKI_VERSION_MINOR
#define CKM_CAST_MAC_GENERAL
void change_so_pin(Slot &slot, const secure_string &old_so_pin, const secure_string &new_so_pin)
#define CKA_SERIAL_NUMBER
#define CKM_SHA512_224_KEY_DERIVATION
#define CKM_SKIPJACK_CFB32
#define CKM_SHA512_HMAC_GENERAL
#define CKR_GENERAL_ERROR
#define CKM_CAMELLIA_CBC_PAD
#define CKA_PUBLIC_KEY_INFO
#define CKR_WRAPPING_KEY_SIZE_RANGE
#define CKM_SSL3_MASTER_KEY_DERIVE
CK_ULONG CK_OBJECT_HANDLE
#define CKF_SO_PIN_COUNT_LOW
#define CKM_CONCATENATE_BASE_AND_DATA
#define CKM_CAST128_MAC_GENERAL
#define CKM_KEA_KEY_DERIVE
void set_pin(Slot &slot, const secure_string &so_pin, const secure_string &pin)
#define CKM_TLS10_MAC_CLIENT
#define CKM_PBE_SHA1_RC4_40
#define CKF_WRITE_PROTECTED
#define CKM_CAST3_CBC_PAD
#define CKM_RIPEMD128_RSA_PKCS
#define CKR_OBJECT_HANDLE_INVALID
#define CKF_USER_FRIENDLY_OTP
#define CKM_TLS_MASTER_KEY_DERIVE_DH
#define CKM_TWOFISH_CBC_PAD
#define CKA_GOST28147_PARAMS
#define CKM_BATON_COUNTER
#define CKM_PBE_SHA1_DES3_EDE_CBC
#define CKR_RANDOM_NO_RNG
#define CKP_PKCS5_PBKD2_HMAC_SHA512_224
PKCS11_Error(const std::string &what)
#define CKM_TWOFISH_KEY_GEN
#define CKR_WRAPPING_KEY_TYPE_INCONSISTENT
#define CKS_RO_PUBLIC_SESSION
#define CKR_ATTRIBUTE_READ_ONLY
#define CKM_RC5_MAC_GENERAL
#define CKR_SESSION_EXISTS
#define CKM_BLOWFISH_KEY_GEN
#define CKR_MUTEX_NOT_LOCKED
unsigned long int CK_ULONG
#define CKM_PBE_SHA1_RC2_40_CBC
#define CKA_ALWAYS_AUTHENTICATE
#define CKF_REMOVABLE_DEVICE
#define CKA_OTP_TIME_REQUIREMENT
#define CKR_TOKEN_WRITE_PROTECTED
#define CKR_DEVICE_MEMORY
struct CK_MECHANISM CK_MECHANISM
#define CKR_INFORMATION_SENSITIVE
#define CKR_EXCEEDED_MAX_ITERATIONS
CK_ULONG CK_ATTRIBUTE_TYPE
#define CKP_PKCS5_PBKD2_HMAC_GOSTR3411
#define CKA_OTP_PIN_REQUIREMENT
#define CKA_ALWAYS_SENSITIVE
CK_ULONG CK_HW_FEATURE_TYPE
#define CKR_LIBRARY_LOAD_FAILED
#define CKM_SSL3_PRE_MASTER_KEY_GEN
#define CKM_SHA512_T_HMAC_GENERAL
#define CKM_AES_ECB_ENCRYPT_DATA
#define CKR_ATTRIBUTE_TYPE_INVALID
#define CKA_VENDOR_DEFINED
#define CKM_AES_XCBC_MAC_96
#define CKM_SHA1_RSA_X9_31
#define CKR_PIN_INCORRECT
#define CKM_DH_PKCS_PARAMETER_GEN
#define CKA_CERTIFICATE_CATEGORY
#define CKM_SHA1_RSA_PKCS_PSS
#define CKM_TLS10_MAC_SERVER
#define CKR_PUBLIC_KEY_INVALID
#define CKF_LOGIN_REQUIRED
#define CKM_VENDOR_DEFINED
#define CKR_STATE_UNSAVEABLE
#define CKM_PBE_SHA1_DES2_EDE_CBC
#define CKR_KEY_INDIGESTIBLE
#define CKM_PBE_MD5_DES_CBC
#define CKA_OTP_SERVICE_LOGO
#define CKF_VERIFY_RECOVER
struct CK_C_INITIALIZE_ARGS CK_C_INITIALIZE_ARGS
CK_FUNCTION_LIST_PTR FunctionListPtr
#define CKR_ACTION_PROHIBITED
#define CKF_EC_UNCOMPRESS
#define CKF_OS_LOCKING_OK
#define CKR_USER_TOO_MANY_TYPES
#define CKM_X9_42_MQV_DERIVE
#define CKA_SECONDARY_AUTH
#define CKM_MD5_KEY_DERIVATION
#define CKM_SHA1_KEY_DERIVATION
CK_CREATEMUTEX CreateMutex
#define CKM_SHA1_RSA_PKCS
CK_SESSION_HANDLE SessionHandle
#define CKM_MD2_KEY_DERIVATION
#define CKA_ALLOWED_MECHANISMS
bool C_Login(SessionHandle session, UserType user_type, const std::vector< uint8_t, TAlloc > &pin, ReturnValue *return_value=ThrowException) const
#define CKK_GENERIC_SECRET
#define CKF_RESTORE_KEY_NOT_NEEDED
#define CKR_OPERATION_ACTIVE
#define CKM_SHA512_224_HMAC_GENERAL
#define CKM_RSA_AES_KEY_WRAP
#define CKM_CONCATENATE_BASE_AND_KEY
CK_ULONG CK_SESSION_HANDLE
#define CKR_KEY_NOT_WRAPPABLE
#define CKM_SHA512_T_KEY_DERIVATION
#define CKS_RO_USER_FUNCTIONS
#define CKF_CLOCK_ON_TOKEN
#define CKA_OTP_USER_IDENTIFIER
#define CKR_FUNCTION_NOT_SUPPORTED
#define CKM_KEY_WRAP_SET_OAEP
#define CKM_SEED_MAC_GENERAL
std::vector< T, secure_allocator< T >> secure_vector
#define CK_CERTIFICATE_CATEGORY_UNSPECIFIED
#define CKM_FORTEZZA_TIMESTAMP
#define CKM_JUNIPER_KEY_GEN
#define CKR_FUNCTION_FAILED
#define CKR_TEMPLATE_INCONSISTENT
#define CKA_PUBLIC_EXPONENT
struct CK_RSA_PKCS_PSS_PARAMS CK_RSA_PKCS_PSS_PARAMS
#define CKM_SHA384_RSA_PKCS
#define CKM_GOST28147_KEY_GEN
#define CKP_PKCS5_PBKD2_HMAC_SHA1
#define CKM_AES_MAC_GENERAL
#define CKR_ARGUMENTS_BAD
#define CRYPTOKI_VERSION_MAJOR
#define CKF_SECONDARY_AUTHENTICATION
#define CKP_PKCS5_PBKD2_HMAC_SHA256
#define CKM_GENERIC_SECRET_KEY_GEN
#define CKM_SHA256_HMAC_GENERAL
#define CKM_BATON_SHUFFLE
#define CKR_BUFFER_TOO_SMALL
#define CKR_USER_NOT_LOGGED_IN
#define CKR_USER_ANOTHER_ALREADY_LOGGED_IN
#define CKM_DSA_PROBABLISTIC_PARAMETER_GEN
#define CKR_FUNCTION_NOT_PARALLEL
#define CKM_DES_ECB_ENCRYPT_DATA
#define CKM_BATON_KEY_GEN
#define CKM_TLS12_KEY_AND_MAC_DERIVE
#define CKM_GOSTR3410_KEY_PAIR_GEN
#define CKM_RIPEMD128_HMAC
#define CKM_X9_42_DH_HYBRID_DERIVE
#define CKM_JUNIPER_ECB128
#define CKF_DUAL_CRYPTO_OPERATIONS
#define CKM_PBE_SHA1_CAST128_CBC
#define CKA_GOSTR3410_PARAMS
#define CKM_SECURID_KEY_GEN
#define CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE
#define CKM_PBE_SHA1_CAST5_CBC
#define CKR_KEY_TYPE_INCONSISTENT
#define CKR_SLOT_ID_INVALID
#define CKM_SHA384_HMAC_GENERAL
#define CKF_SO_PIN_LOCKED
bool C_InitToken(SlotId slot_id, const std::vector< uint8_t, TAlloc > &so_pin, const std::string &label, ReturnValue *return_value=ThrowException) const
#define CKM_SHA512_KEY_DERIVATION
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
#define CKR_KEY_NOT_NEEDED
#define CKR_ATTRIBUTE_VALUE_INVALID
#define CKM_ECDSA_KEY_PAIR_GEN
#define CKM_TLS12_KEY_SAFE_DERIVE
#define CKC_VENDOR_DEFINED
#define CKR_SIGNATURE_LEN_RANGE
#define CKA_NAME_HASH_ALGORITHM
bool C_SetAttributeValue(SessionHandle session, ObjectHandle object, std::map< AttributeType, std::vector< uint8_t, TAlloc >> &attribute_values, ReturnValue *return_value=ThrowException) const
#define CKF_USER_PIN_LOCKED
#define CKR_KEY_SIZE_RANGE
#define CKA_MECHANISM_TYPE
#define CKM_EC_KEY_PAIR_GEN
#define CKA_SUBPRIME_BITS
#define CKA_DERIVE_TEMPLATE
#define CKM_MD5_HMAC_GENERAL
#define CKR_CRYPTOKI_ALREADY_INITIALIZED
#define CKF_USER_PIN_COUNT_LOW
#define CKM_CONCATENATE_DATA_AND_BASE
#define CKF_SO_PIN_TO_BE_CHANGED
#define CKM_SKIPJACK_RELAYX
#define CKM_WTLS_MASTER_KEY_DERIVE
#define CKM_JUNIPER_CBC128
#define CKK_RIPEMD160_HMAC
#define CKR_NEED_TO_CREATE_THREADS
void initialize_token(Slot &slot, const std::string &label, const secure_string &so_pin, const secure_string &pin)
Provides access to all PKCS#11 functions.
#define CKM_GOSTR3410_DERIVE
CK_OBJECT_HANDLE ObjectHandle
struct CK_SESSION_INFO CK_SESSION_INFO
#define CKR_CRYPTOKI_NOT_INITIALIZED
#define CKR_WRAPPING_KEY_HANDLE_INVALID
#define CKM_MD2_HMAC_GENERAL
#define CKM_SHA384_RSA_PKCS_PSS
#define CKR_TOKEN_NOT_PRESENT
void change_pin(Slot &slot, const secure_string &old_pin, const secure_string &new_pin)
#define CKM_DES_CBC_ENCRYPT_DATA
#define CKM_TLS_MASTER_KEY_DERIVE
#define CKR_UNWRAPPING_KEY_HANDLE_INVALID
#define CKM_JUNIPER_SHUFFLE
#define CKR_FUNCTION_REJECTED
#define CKA_GOSTR3411_PARAMS
#define CKM_RIPEMD160_HMAC
CK_FUNCTION_LIST CK_PTR CK_FUNCTION_LIST_PTR
#define CKM_SKIPJACK_OFB64
#define CKA_OTP_USER_FRIENDLY_MODE
#define CKA_SUPPORTED_CMS_ATTRIBUTES
#define CKF_SO_PIN_FINAL_TRY
#define CKP_PKCS5_PBKD2_HMAC_SHA224
#define CKM_SKIPJACK_CBC64
#define CKO_VENDOR_DEFINED
#define CKM_CAST5_CBC_PAD
#define CKR_TOKEN_NOT_RECOGNIZED
#define CKM_CAST5_MAC_GENERAL
#define CKR_SESSION_PARALLEL_NOT_SUPPORTED
#define CKM_ECDH1_COFACTOR_DERIVE
#define CKA_NEVER_EXTRACTABLE
bool C_GetAttributeValue(SessionHandle session, ObjectHandle object, std::map< AttributeType, std::vector< uint8_t, TAlloc >> &attribute_values, ReturnValue *return_value=ThrowException) const
#define CKM_SHA224_HMAC_GENERAL
CK_ULONG CK_CERTIFICATE_TYPE
#define CKM_SHA512_256_HMAC_GENERAL
#define CKM_AES_KEY_WRAP_PAD
#define CKM_TLS12_MASTER_KEY_DERIVE_DH
#define CKA_VERIFY_RECOVER
#define CKA_RESET_ON_INIT
#define CKM_DES3_MAC_GENERAL
#define CKR_USER_TYPE_INVALID
bool C_VerifyUpdate(SessionHandle session, std::vector< uint8_t, TAlloc > part, ReturnValue *return_value=ThrowException) const
#define CKM_X9_42_DH_PARAMETER_GEN
#define CKH_VENDOR_DEFINED
#define CKR_UNWRAPPING_KEY_SIZE_RANGE
#define CKR_SESSION_HANDLE_INVALID
#define CKM_RIPEMD160_HMAC_GENERAL
#define CKA_BITS_PER_PIXEL
std::string to_string(const secure_vector< uint8_t > &bytes)
#define CKR_USER_ALREADY_LOGGED_IN
#define CKM_SKIPJACK_ECB64
#define CKM_SSL3_KEY_AND_MAC_DERIVE
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
#define CKM_ARIA_MAC_GENERAL
#define CKM_EXTRACT_KEY_FROM_KEY
#define CKR_PIN_LEN_RANGE
#define CKC_X_509_ATTR_CERT
#define CKM_RSA_PKCS_OAEP_TPM_1_1
#define CKA_DEFAULT_CMS_ATTRIBUTES
#define CKO_DOMAIN_PARAMETERS
#define CKR_KEY_UNEXTRACTABLE
#define CKM_KEA_KEY_PAIR_GEN
#define CKM_GOST28147_KEY_WRAP
#define CKR_SESSION_READ_ONLY_EXISTS
struct CK_SLOT_INFO CK_SLOT_INFO
#define CKR_WRAPPED_KEY_LEN_RANGE
#define CKF_SERIAL_SESSION
#define CKA_KEY_GEN_MECHANISM
struct CK_ECDH1_DERIVE_PARAMS CK_ECDH1_DERIVE_PARAMS
ReturnValue get_return_value() const
#define CKR_MECHANISM_INVALID
#define CKM_PBE_MD2_DES_CBC
#define CKR_KEY_FUNCTION_NOT_PERMITTED
#define CKM_DSA_KEY_PAIR_GEN
#define CKF_USER_PIN_TO_BE_CHANGED
#define CKR_VENDOR_DEFINED
#define CKA_OTP_TIME_INTERVAL
#define CKM_ARIA_CBC_ENCRYPT_DATA
#define CKP_PKCS5_PBKD2_HMAC_SHA512_256
#define CKR_SESSION_READ_ONLY
#define CKM_GOST28147_MAC
secure_vector< uint8_t > secure_string
#define CKR_MECHANISM_PARAM_INVALID
#define CKM_WTLS_PRE_MASTER_KEY_GEN
#define CKF_TOKEN_INITIALIZED
#define CKM_GOSTR3411_HMAC
#define CKM_DES3_ECB_ENCRYPT_DATA
CK_ULONG CK_RSA_PKCS_MGF_TYPE
#define CKM_ECDH_AES_KEY_WRAP
#define CKM_PBE_SHA1_RC4_128
#define CKP_PKCS5_PBKD2_HMAC_SHA384
PKCS11_ReturnError(ReturnValue return_val)
#define CKM_SHA224_KEY_DERIVATION
#define CKM_CAST3_MAC_GENERAL
#define CKR_KEY_HANDLE_INVALID
#define CKM_GOSTR3410_KEY_WRAP
struct CK_MECHANISM_INFO CK_MECHANISM_INFO
#define CKM_DSA_SHAWE_TAYLOR_PARAMETER_GEN
#define CKA_HASH_OF_SUBJECT_PUBLIC_KEY
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
#define CKS_RW_PUBLIC_SESSION
#define CKM_SHA512_256_HMAC
CK_ULONG CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE
#define CKM_PBE_MD5_CAST3_CBC
#define CKM_SHA512_256_KEY_DERIVATION
#define CKR_DOMAIN_PARAMS_INVALID
#define CKM_SKIPJACK_PRIVATE_WRAP
bool C_InitPIN(SessionHandle session, const std::vector< uint8_t, TAlloc > &pin, ReturnValue *return_value=ThrowException) const
#define CKR_USER_PIN_NOT_INITIALIZED
#define CKM_RSA_PKCS_OAEP
#define CKA_WRAP_TEMPLATE
#define CKM_CAMELLIA_KEY_GEN
#define CK_CERTIFICATE_CATEGORY_TOKEN_USER
#define CKM_SHA512_T_HMAC
bool C_Verify(SessionHandle session, const std::vector< uint8_t, TAllocA > &data, std::vector< uint8_t, TAllocB > &signature, ReturnValue *return_value=ThrowException) const
#define CKD_SHA1_KDF_ASN1
#define CKS_RW_SO_FUNCTIONS
#define CKM_DH_PKCS_KEY_PAIR_GEN
#define CKM_CAST128_CBC_PAD
#define CKA_OTP_SERVICE_IDENTIFIER
#define CKA_AUTH_PIN_FLAGS
CK_DESTROYMUTEX DestroyMutex
struct CK_ATTRIBUTE CK_ATTRIBUTE
#define CKM_RIPEMD160_RSA_PKCS
#define CKR_SESSION_CLOSED
#define CKR_ENCRYPTED_DATA_LEN_RANGE
bool C_SignFinal(SessionHandle session, std::vector< uint8_t, TAlloc > &signature, ReturnValue *return_value=ThrowException) const
#define CKR_WRAPPED_KEY_INVALID
#define CKM_SHA224_RSA_PKCS_PSS
#define CKM_SHA512_224_HMAC
#define CKM_SKIPJACK_CFB16
#define CKR_SESSION_COUNT
#define CKM_AES_CBC_ENCRYPT_DATA
#define CKA_OTP_CHALLENGE_REQUIREMENT
#define CKM_SHA256_RSA_PKCS
#define CKK_RIPEMD128_HMAC
#define CKM_CDMF_MAC_GENERAL
#define CKM_RSA_X9_31_KEY_PAIR_GEN
#define CKF_ARRAY_ATTRIBUTE
#define CKM_RC2_MAC_GENERAL
#define CKM_X9_42_DH_DERIVE
#define CKA_SUB_PRIME_BITS
#define CKM_SSL3_SHA1_MAC
#define CKM_SHA256_KEY_DERIVATION
#define CKM_DES_MAC_GENERAL
#define CKM_X9_42_DH_KEY_PAIR_GEN
#define CKM_TLS_KEY_AND_MAC_DERIVE
#define CKF_EXCLUDE_CHALLENGE
#define CKR_CURVE_NOT_SUPPORTED
#define CKM_DH_PKCS_DERIVE
#define CKR_TEMPLATE_INCOMPLETE
#define CKM_TLS12_MASTER_KEY_DERIVE
#define CKR_SESSION_READ_WRITE_SO_EXISTS
#define CKM_PBE_MD5_CAST128_CBC
#define CKA_JAVA_MIDP_SECURITY_DOMAIN
#define CKR_DATA_LEN_RANGE
#define CKM_IDEA_MAC_GENERAL
#define CKM_BLOWFISH_CBC_PAD
#define CKA_HASH_OF_ISSUER_PUBLIC_KEY
#define CKR_OPERATION_NOT_INITIALIZED
#define CKF_USER_PIN_FINAL_TRY
#define CKM_SSL3_MASTER_KEY_DERIVE_DH
#define CKD_CPDIVERSIFY_KDF
#define CKA_CERTIFICATE_TYPE
#define CKM_GOST28147_ECB
#define CKM_CAST128_KEY_GEN
#define CKM_CAST5_KEY_GEN
#define CKM_SKIPJACK_CFB64
#define CKM_SHA256_RSA_PKCS_PSS