Botan 2.19.5 Crypto and TLS for C&

Public Member Functions | Static Public Member Functions | List of all members
Botan::PKCS11::LowLevel Class Reference

Provides access to all PKCS#11 functions. More...

`#include <p11.h>`

## Public Member Functions
bool | C_CancelFunction (SessionHandle session, ReturnValue *return_value=ThrowException) const
bool | C_CloseAllSessions (SlotId slot_id, ReturnValue *return_value=ThrowException) const
bool | C_CloseSession (SessionHandle session, ReturnValue *return_value=ThrowException) const
bool | C_CopyObject (SessionHandle session, ObjectHandle object, Attribute *attribute_template_ptr, Ulong count, ObjectHandle *new_object_ptr, ReturnValue *return_value=ThrowException) const
bool | C_CreateObject (SessionHandle session, Attribute *attribute_template_ptr, Ulong count, ObjectHandle *object_ptr, 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
template<typename TAllocA , typename TAllocB >
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_DecryptDigestUpdate (SessionHandle session, Byte *encrypted_part_ptr, Ulong encrypted_part_len, Byte *part_ptr, Ulong *part_len_ptr, ReturnValue *return_value=ThrowException) const
bool | C_DecryptFinal (SessionHandle session, Byte *last_part_ptr, Ulong *last_part_len_ptr, ReturnValue *return_value=ThrowException) const
bool | C_DecryptInit (SessionHandle session, Mechanism *mechanism_ptr, ObjectHandle key, ReturnValue *return_value=ThrowException) const
bool | C_DecryptUpdate (SessionHandle session, Byte *encrypted_part_ptr, Ulong encrypted_part_len, Byte *part_ptr, Ulong *part_len_ptr, ReturnValue *return_value=ThrowException) const
bool | C_DecryptVerifyUpdate (SessionHandle session, Byte *encrypted_part_ptr, Ulong encrypted_part_len, Byte *part_ptr, Ulong *part_len_ptr, ReturnValue *return_value=ThrowException) const
bool | C_DeriveKey (SessionHandle session, Mechanism *mechanism_ptr, ObjectHandle base_key, Attribute *attribute_template_ptr, Ulong attribute_count, ObjectHandle *key_ptr, ReturnValue *return_value=ThrowException) const
bool | C_DestroyObject (SessionHandle session, ObjectHandle object, ReturnValue *return_value=ThrowException) const
bool | C_Digest (SessionHandle session, Byte *data_ptr, Ulong data_len, Byte *digest_ptr, Ulong *digest_len_ptr, ReturnValue *return_value=ThrowException) const
bool | C_DigestEncryptUpdate (SessionHandle session, Byte *part_ptr, Ulong part_len, Byte *encrypted_part_ptr, Ulong *encrypted_part_len_ptr, ReturnValue *return_value=ThrowException) const
bool | C_DigestFinal (SessionHandle session, Byte *digest_ptr, Ulong *digest_len_ptr, ReturnValue *return_value=ThrowException) const
bool | C_DigestInit (SessionHandle session, Mechanism *mechanism_ptr, ReturnValue *return_value=ThrowException) const
bool | C_DigestKey (SessionHandle session, ObjectHandle key, ReturnValue *return_value=ThrowException) const
bool | C_DigestUpdate (SessionHandle session, Byte *part_ptr, Ulong part_len, 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
template<typename TAllocA , typename TAllocB >
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_EncryptFinal (SessionHandle session, Byte *last_encrypted_part_ptr, Ulong *last_encrypted_part_len_ptr, ReturnValue *return_value=ThrowException) const
bool | C_EncryptInit (SessionHandle session, Mechanism *mechanism_ptr, ObjectHandle key, ReturnValue *return_value=ThrowException) const
bool | C_EncryptUpdate (SessionHandle session, Byte *part_ptr, Ulong part_len, Byte *encrypted_part_ptr, Ulong *encrypted_part_len_ptr, ReturnValue *return_value=ThrowException) const
bool | C_Finalize (VoidPtr reserved, ReturnValue *return_value=ThrowException) const
bool | C_FindObjects (SessionHandle session, ObjectHandle *object_ptr, Ulong max_object_count, Ulong *object_count_ptr, ReturnValue *return_value=ThrowException) const
bool | C_FindObjectsFinal (SessionHandle session, ReturnValue *return_value=ThrowException) const
bool | C_FindObjectsInit (SessionHandle session, Attribute *attribute_template_ptr, Ulong count, ReturnValue *return_value=ThrowException) const
bool | C_GenerateKey (SessionHandle session, Mechanism *mechanism_ptr, Attribute *attribute_template_ptr, Ulong count, ObjectHandle *key_ptr, ReturnValue *return_value=ThrowException) const
bool | C_GenerateKeyPair (SessionHandle session, Mechanism *mechanism_ptr, Attribute *public_key_template_ptr, Ulong public_key_attribute_count, Attribute *private_key_template_ptr, Ulong private_key_attribute_count, ObjectHandle *public_key_ptr, ObjectHandle *private_key_ptr, ReturnValue *return_value=ThrowException) const
bool | C_GenerateRandom (SessionHandle session, Byte *random_data_ptr, Ulong random_len, ReturnValue *return_value=ThrowException) const
bool | C_GetAttributeValue (SessionHandle session, ObjectHandle object, Attribute *attribute_template_ptr, Ulong count, ReturnValue *return_value=ThrowException) const
template<typename TAlloc >
bool | C_GetAttributeValue (SessionHandle session, ObjectHandle object, std::map< AttributeType, std::vector< uint8_t, TAlloc > > &attribute_values, ReturnValue *return_value=ThrowException) const
bool | C_GetFunctionStatus (SessionHandle session, ReturnValue *return_value=ThrowException) const
bool | C_GetInfo (Info *info_ptr, ReturnValue *return_value=ThrowException) const
bool | C_GetMechanismInfo (SlotId slot_id, MechanismType type, MechanismInfo *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_GetMechanismList (SlotId slot_id, std::vector< MechanismType > &mechanisms, ReturnValue *return_value=ThrowException) const
bool | C_GetObjectSize (SessionHandle session, ObjectHandle object, Ulong *size_ptr, ReturnValue *return_value=ThrowException) const
bool | C_GetOperationState (SessionHandle session, Byte *operation_state_ptr, Ulong *operation_state_len_ptr, ReturnValue *return_value=ThrowException) const
bool | C_GetSessionInfo (SessionHandle session, SessionInfo *info_ptr, ReturnValue *return_value=ThrowException) const
bool | C_GetSlotInfo (SlotId slot_id, SlotInfo *info_ptr, 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_GetSlotList (bool token_present, std::vector< SlotId > &slot_ids, ReturnValue *return_value=ThrowException) const
bool | C_GetTokenInfo (SlotId slot_id, TokenInfo *info_ptr, ReturnValue *return_value=ThrowException) const
bool | C_Initialize (VoidPtr init_args, ReturnValue *return_value=ThrowException) const
template<typename TAlloc >
bool | C_InitPIN (SessionHandle session, const std::vector< uint8_t, TAlloc > &pin, ReturnValue *return_value=ThrowException) const
bool | C_InitPIN (SessionHandle session, Utf8Char *pin_ptr, Ulong pin_len, ReturnValue *return_value=ThrowException) const
template<typename TAlloc >
bool | C_InitToken (SlotId slot_id, const std::vector< uint8_t, TAlloc > &so_pin, const std::string &label, ReturnValue *return_value=ThrowException) const
bool | C_InitToken (SlotId slot_id, Utf8Char *so_pin_ptr, Ulong so_pin_len, Utf8Char *label_ptr, ReturnValue *return_value=ThrowException) const
template<typename TAlloc >
bool | C_Login (SessionHandle session, UserType user_type, const std::vector< uint8_t, TAlloc > &pin, 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_Logout (SessionHandle session, ReturnValue *return_value=ThrowException) const
bool | C_OpenSession (SlotId slot_id, Flags flags, VoidPtr application, Notify notify, SessionHandle *session_ptr, ReturnValue *return_value=ThrowException) const
bool | C_SeedRandom (SessionHandle session, Byte *seed_ptr, Ulong seed_len, ReturnValue *return_value=ThrowException) const
bool | C_SetAttributeValue (SessionHandle session, ObjectHandle object, Attribute *attribute_template_ptr, Ulong count, ReturnValue *return_value=ThrowException) const
template<typename TAlloc >
bool | C_SetAttributeValue (SessionHandle session, ObjectHandle object, std::map< AttributeType, std::vector< uint8_t, TAlloc > > &attribute_values, ReturnValue *return_value=ThrowException) const
bool | C_SetOperationState (SessionHandle session, Byte *operation_state_ptr, Ulong operation_state_len, ObjectHandle encryption_key, ObjectHandle authentication_key, ReturnValue *return_value=ThrowException) const
template<typename TAlloc >
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_SetPIN (SessionHandle session, Utf8Char *old_pin_ptr, Ulong old_len, Utf8Char *new_pin_ptr, Ulong new_len, ReturnValue *return_value=ThrowException) const
bool | C_Sign (SessionHandle session, Byte *data_ptr, Ulong data_len, Byte *signature_ptr, Ulong *signature_len_ptr, ReturnValue *return_value=ThrowException) const
template<typename TAllocA , typename TAllocB >
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_SignEncryptUpdate (SessionHandle session, Byte *part_ptr, Ulong part_len, Byte *encrypted_part_ptr, Ulong *encrypted_part_len_ptr, ReturnValue *return_value=ThrowException) const
bool | C_SignFinal (SessionHandle session, Byte *signature_ptr, Ulong *signature_len_ptr, ReturnValue *return_value=ThrowException) const
template<typename TAlloc >
bool | C_SignFinal (SessionHandle session, std::vector< uint8_t, TAlloc > &signature, ReturnValue *return_value=ThrowException) const
bool | C_SignInit (SessionHandle session, Mechanism *mechanism_ptr, ObjectHandle key, ReturnValue *return_value=ThrowException) const
bool | C_SignRecover (SessionHandle session, Byte *data_ptr, Ulong data_len, Byte *signature_ptr, Ulong *signature_len_ptr, ReturnValue *return_value=ThrowException) const
bool | C_SignRecoverInit (SessionHandle session, Mechanism *mechanism_ptr, ObjectHandle key, ReturnValue *return_value=ThrowException) const
bool | C_SignUpdate (SessionHandle session, Byte *part_ptr, Ulong part_len, ReturnValue *return_value=ThrowException) const
template<typename TAlloc >
bool | C_SignUpdate (SessionHandle session, const std::vector< uint8_t, TAlloc > &part, ReturnValue *return_value=ThrowException) const
bool | C_UnwrapKey (SessionHandle session, Mechanism *mechanism_ptr, ObjectHandle unwrapping_key, Byte *wrapped_key_ptr, Ulong wrapped_key_len, Attribute *attribute_template_ptr, Ulong attribute_count, ObjectHandle *key_ptr, ReturnValue *return_value=ThrowException) const
bool | C_Verify (SessionHandle session, Byte *data_ptr, Ulong data_len, Byte *signature_ptr, Ulong signature_len, ReturnValue *return_value=ThrowException) const
template<typename TAllocA , typename TAllocB >
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_VerifyFinal (SessionHandle session, Byte *signature_ptr, Ulong signature_len, ReturnValue *return_value=ThrowException) const
bool | C_VerifyInit (SessionHandle session, Mechanism *mechanism_ptr, ObjectHandle key, ReturnValue *return_value=ThrowException) const
bool | C_VerifyRecover (SessionHandle session, Byte *signature_ptr, Ulong signature_len, Byte *data_ptr, Ulong *data_len_ptr, ReturnValue *return_value=ThrowException) const
bool | C_VerifyRecoverInit (SessionHandle session, Mechanism *mechanism_ptr, ObjectHandle key, ReturnValue *return_value=ThrowException) const
bool | C_VerifyUpdate (SessionHandle session, Byte *part_ptr, Ulong part_len, ReturnValue *return_value=ThrowException) const
template<typename TAlloc >
bool | C_VerifyUpdate (SessionHandle session, 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_WrapKey (SessionHandle session, Mechanism *mechanism_ptr, ObjectHandle wrapping_key, ObjectHandle key, Byte *wrapped_key_ptr, Ulong *wrapped_key_len_ptr, ReturnValue *return_value=ThrowException) const
| LowLevel (FunctionListPtr ptr)

## Static Public Member Functions
static bool | C_GetFunctionList (Dynamically_Loaded_Library &pkcs11_module, FunctionListPtr *function_list_ptr_ptr, ReturnValue *return_value=ThrowException)

## Detailed Description

Provides access to all PKCS#11 functions.

Definition at line 903 of file p11.h.

## Constructor & Destructor Documentation

## ◆ LowLevel()

Botan::PKCS11::LowLevel::LowLevel | ( | FunctionListPtr | ptr | ) |
| explicit

Parameters

  ptr | the functon list pointer to use. Can be retrieved via `LowLevel::C_GetFunctionList`

Definition at line 74 of file p11.cpp.

74 :
75 m_func_list_ptr(ptr)
76 {
77 if(m_func_list_ptr == nullptr)
78 {
79 throw Invalid_Argument("Invalid PKCS#11 function list ptr");
80 }
81 }

## Member Function Documentation

## ◆ C_CancelFunction()

bool Botan::PKCS11::LowLevel::C_CancelFunction | ( | SessionHandle | session,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_CancelFunction is a legacy function; it cancels a function running in parallel.

Parameters

  session | the session's handle
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: CryptokiNotInitialized FunctionFailed FunctionNotParallel GeneralError HostMemory SessionHandleInvalid SessionClosed

Returns
  true on success, false otherwise

Definition at line 759 of file p11.cpp.

761 {
762 return handle_return_value(m_func_list_ptr->C_CancelFunction(session), return_value);
763 }

## ◆ C_CloseAllSessions()

bool Botan::PKCS11::LowLevel::C_CloseAllSessions | ( | SlotId | slot_id,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_CloseAllSessions closes all sessions with a token.

Parameters

  slot_id | the token's slot
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionFailed GeneralError HostMemory OK SlotIdInvalid TokenNotPresent

Returns
  true on success, false otherwise

Definition at line 253 of file p11.cpp.

255 {
256 return handle_return_value(m_func_list_ptr->C_CloseAllSessions(slot_id), return_value);
257 }

## ◆ C_CloseSession()

bool Botan::PKCS11::LowLevel::C_CloseSession | ( | SessionHandle | session,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_CloseSession closes a session between an application and a token.

Parameters

  session | the session's handle
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionFailed GeneralError HostMemory OK SessionClosed SessionHandleInvalid

Returns
  true on success, false otherwise

Definition at line 247 of file p11.cpp.

249 {
250 return handle_return_value(m_func_list_ptr->C_CloseSession(session), return_value);
251 }

Referenced by Botan::PKCS11::Session::~Session().

## ◆ C_CopyObject()

bool Botan::PKCS11::LowLevel::C_CopyObject | ( | SessionHandle | session,
|  | ObjectHandle | object,
|  | Attribute * | attribute_template_ptr,
|  | Ulong | count,
|  | ObjectHandle * | new_object_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_CopyObject copies an object, creating a new object for the copy.

Parameters

  session | the session's handle
  object | the object's handle
  attribute_template_ptr | template for new object
  count | attributes in template
  new_object_ptr | receives handle of copy
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ActionProhibited ArgumentsBad AttributeReadOnly AttributeTypeInvalid AttributeValueInvalid CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionFailed GeneralError HostMemory ObjectHandleInvalid OK PinExpired SessionClosed SessionHandleInvalid SessionReadOnly TemplateInconsistent TokenWriteProtected UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 314 of file p11.cpp.

320 {
321 return handle_return_value(m_func_list_ptr->C_CopyObject(session, object, attribute_template_ptr, count,
322 new_object_ptr), return_value);
323 }

Referenced by Botan::PKCS11::Object::copy().

## ◆ C_CreateObject()

bool Botan::PKCS11::LowLevel::C_CreateObject | ( | SessionHandle | session,
|  | Attribute * | attribute_template_ptr,
|  | Ulong | count,
|  | ObjectHandle * | object_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_CreateObject creates a new object.

Parameters

  session | the session's handle
  attribute_template_ptr | the object's template
  count | attributes in template
  object_ptr | gets new object's handle.
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad AttributeReadOnly AttributeTypeInvalid AttributeValueInvalid CryptokiNotInitialized CurveNotSupported DeviceError DeviceMemory DeviceRemoved DomainParamsInvalid FunctionFailed GeneralError HostMemory OK PinExpired SessionClosed SessionHandleInvalid SessionReadOnly TemplateIncomplete TemplateInconsistent TokenWriteProtected UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 304 of file p11.cpp.

309 {
310 return handle_return_value(m_func_list_ptr->C_CreateObject(session, attribute_template_ptr, count, object_ptr),
311 return_value);
312 }

## ◆ C_Decrypt() [1/2]

bool Botan::PKCS11::LowLevel::C_Decrypt | ( | SessionHandle | session,
|  | Byte * | encrypted_data_ptr,
|  | Ulong | encrypted_data_len,
|  | Byte * | data_ptr,
|  | Ulong * | data_len_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_Decrypt decrypts encrypted data in a single part.

Parameters

  session | session's handle
  encrypted_data_ptr | ciphertext
  encrypted_data_len | ciphertext length
  data_ptr | gets plaintext
  data_len_ptr | gets p-text size
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved EncryptedDataInvalid EncryptedDataLenRange FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 435 of file p11.cpp.

441 {
442 return handle_return_value(m_func_list_ptr->C_Decrypt(session, encrypted_data_ptr, encrypted_data_len, data_ptr,
443 data_len_ptr), return_value);
444 }

## ◆ C_Decrypt() [2/2]

template<typename TAllocA , typename TAllocB >

bool Botan::PKCS11::LowLevel::C_Decrypt | ( | SessionHandle | session,
|  | const std::vector< uint8_t, TAllocA > & | encrypted_data,
|  | std::vector< uint8_t, TAllocB > & | decrypted_data,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const
| inline

C_Decrypt decrypts encrypted data in a single part.

Parameters

  session | session's handle
  encrypted_data | ciphertext
  decrypted_data | gets plaintext
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved EncryptedDataInvalid EncryptedDataLenRange FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 1944 of file p11.h.

1948 {
1949 Ulong decrypted_size = 0;
1950 if(!C_Decrypt(session,
1951 const_cast<Byte*>((encrypted_data.data())),
1952 static_cast<Ulong>(encrypted_data.size()),
1953 nullptr, &decrypted_size,
1954 return_value))
1955 {
1956 return false;
1957 }
1958
1959 decrypted_data.resize(decrypted_size);
1960 if(!C_Decrypt(session,
1961 const_cast<Byte*>(encrypted_data.data()),
1962 static_cast<Ulong>(encrypted_data.size()),
1963 decrypted_data.data(),
1964 &decrypted_size, return_value))
1965 {
1966 return false;
1967 }
1968 decrypted_data.resize(decrypted_size);
1969 return true;
1970 }
Botan::PKCS11::LowLevel::C_Decrypt
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
Definition: p11.cpp:435
Botan::PKCS11::Ulong
CK_ULONG Ulong
Definition: p11.h:838
Botan::PKCS11::Byte
CK_BYTE Byte
Definition: p11.h:849

## ◆ C_DecryptDigestUpdate()

bool Botan::PKCS11::LowLevel::C_DecryptDigestUpdate | ( | SessionHandle | session,
|  | Byte * | encrypted_part_ptr,
|  | Ulong | encrypted_part_len,
|  | Byte * | part_ptr,
|  | Ulong * | part_len_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_DecryptDigestUpdate continues a multiple-part decryption and digesting operation.

Parameters

  session | session's handle
  encrypted_part_ptr | ciphertext
  encrypted_part_len | ciphertext length
  part_ptr | gets plaintext
  part_len_ptr | gets plaintext len
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved EncryptedDataInvalid EncryptedDataLenRange FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid

Returns
  true on success, false otherwise

Definition at line 633 of file p11.cpp.

639 {
640 return handle_return_value(m_func_list_ptr->C_DecryptDigestUpdate(session, encrypted_part_ptr, encrypted_part_len,
641 part_ptr, part_len_ptr), return_value);
642 }

## ◆ C_DecryptFinal()

bool Botan::PKCS11::LowLevel::C_DecryptFinal | ( | SessionHandle | session,
|  | Byte * | last_part_ptr,
|  | Ulong * | last_part_len_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_DecryptFinal finishes a multiple-part decryption operation.

Parameters

  session | the session's handle
  last_part_ptr | gets plaintext
  last_part_len_ptr | p-text size
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved EncryptedDataInvalid EncryptedDataLenRange FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 457 of file p11.cpp.

461 {
462 return handle_return_value(m_func_list_ptr->C_DecryptFinal(session, last_part_ptr, last_part_len_ptr), return_value);
463 }

## ◆ C_DecryptInit()

bool Botan::PKCS11::LowLevel::C_DecryptInit | ( | SessionHandle | session,
|  | Mechanism * | mechanism_ptr,
|  | ObjectHandle | key,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_DecryptInit initializes a decryption operation.

Parameters

  session | the session's handle
  mechanism_ptr | the decryption mechanism
  key | handle of decryption key
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory KeyFunctionNotPermitted KeyHandleInvalid KeySizeRange KeyTypeInconsistent MechanismInvalid MechanismParamInvalid OK OperationActive PinExpired SessionClosed SessionHandleInvalid UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 427 of file p11.cpp.

431 {
432 return handle_return_value(m_func_list_ptr->C_DecryptInit(session, mechanism_ptr, key), return_value);
433 }

## ◆ C_DecryptUpdate()

bool Botan::PKCS11::LowLevel::C_DecryptUpdate | ( | SessionHandle | session,
|  | Byte * | encrypted_part_ptr,
|  | Ulong | encrypted_part_len,
|  | Byte * | part_ptr,
|  | Ulong * | part_len_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_DecryptUpdate continues a multiple-part decryption operation.

Parameters

  session | session's handle
  encrypted_part_ptr | encrypted data
  encrypted_part_len | input length
  part_ptr | gets plaintext
  part_len_ptr | p-text size
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved EncryptedDataInvalid EncryptedDataLenRange FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 446 of file p11.cpp.

452 {
453 return handle_return_value(m_func_list_ptr->C_DecryptUpdate(session, encrypted_part_ptr, encrypted_part_len, part_ptr,
454 part_len_ptr), return_value);
455 }

## ◆ C_DecryptVerifyUpdate()

bool Botan::PKCS11::LowLevel::C_DecryptVerifyUpdate | ( | SessionHandle | session,
|  | Byte * | encrypted_part_ptr,
|  | Ulong | encrypted_part_len,
|  | Byte * | part_ptr,
|  | Ulong * | part_len_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_DecryptVerifyUpdate continues a multiple-part decryption and verify operation.

Parameters

  session | session's handle
  encrypted_part_ptr | ciphertext
  encrypted_part_len | ciphertext length
  part_ptr | gets plaintext
  part_len_ptr | gets p-text length
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized DataLenRange DeviceError DeviceMemory DeviceRemoved EncryptedDataInvalid EncryptedDataLenRange FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid

Returns
  true on success, false otherwise

Definition at line 655 of file p11.cpp.

661 {
662 return handle_return_value(m_func_list_ptr->C_DecryptVerifyUpdate(session, encrypted_part_ptr, encrypted_part_len,
663 part_ptr, part_len_ptr), return_value);
664 }

## ◆ C_DeriveKey()

bool Botan::PKCS11::LowLevel::C_DeriveKey | ( | SessionHandle | session,
|  | Mechanism * | mechanism_ptr,
|  | ObjectHandle | base_key,
|  | Attribute * | attribute_template_ptr,
|  | Ulong | attribute_count,
|  | ObjectHandle * | key_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_DeriveKey derives a key from a base key, creating a new key object.

Parameters

  session | session's handle
  mechanism_ptr | key deriv. mech.
  base_key | base key
  attribute_template_ptr | new key template
  attribute_count | template length
  key_ptr | gets new handle
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad AttributeReadOnly AttributeTypeInvalid AttributeValueInvalid CryptokiNotInitialized CurveNotSupported DeviceError DeviceMemory DeviceRemoved DomainParamsInvalid FunctionCanceled FunctionFailed GeneralError HostMemory KeyHandleInvalid KeySizeRange KeyTypeInconsistent MechanismInvalid MechanismParamInvalid OK OperationActive PinExpired SessionClosed SessionHandleInvalid SessionReadOnly TemplateIncomplete TemplateInconsistent TokenWriteProtected UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 721 of file p11.cpp.

728 {
729 return handle_return_value(m_func_list_ptr->C_DeriveKey(session, mechanism_ptr, base_key, attribute_template_ptr,
730 attribute_count, key_ptr), return_value);
731 }

## ◆ C_DestroyObject()

bool Botan::PKCS11::LowLevel::C_DestroyObject | ( | SessionHandle | session,
|  | ObjectHandle | object,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_DestroyObject destroys an object.

Parameters

  session | the session's handle
  object | the object's handle
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ActionProhibited CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionFailed GeneralError HostMemory ObjectHandleInvalid OK PinExpired SessionClosed SessionHandleInvalid SessionReadOnly TokenWriteProtected

Returns
  true on success, false otherwise

Definition at line 325 of file p11.cpp.

328 {
329 return handle_return_value(m_func_list_ptr->C_DestroyObject(session, object), return_value);
330 }

Referenced by Botan::PKCS11::Object::destroy().

## ◆ C_Digest()

bool Botan::PKCS11::LowLevel::C_Digest | ( | SessionHandle | session,
|  | Byte * | data_ptr,
|  | Ulong | data_len,
|  | Byte * | digest_ptr,
|  | Ulong * | digest_len_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_Digest digests data in a single part.

Parameters

  session | the session's handle
  data_ptr | data to be digested
  data_len | bytes of data to digest
  digest_ptr | gets the message digest
  digest_len_ptr | gets digest length
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid

Returns
  true on success, false otherwise

Definition at line 474 of file p11.cpp.

480 {
481 return handle_return_value(m_func_list_ptr->C_Digest(session, data_ptr, data_len, digest_ptr, digest_len_ptr),
482 return_value);
483 }

## ◆ C_DigestEncryptUpdate()

bool Botan::PKCS11::LowLevel::C_DigestEncryptUpdate | ( | SessionHandle | session,
|  | Byte * | part_ptr,
|  | Ulong | part_len,
|  | Byte * | encrypted_part_ptr,
|  | Ulong * | encrypted_part_len_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_DigestEncryptUpdate continues a multiple-part digesting and encryption operation.

Parameters

  session | session's handle
  part_ptr | the plaintext data
  part_len | plaintext length
  encrypted_part_ptr | gets ciphertext
  encrypted_part_len_ptr | gets c-text length
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized DataLenRange DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid

Returns
  true on success, false otherwise

Definition at line 622 of file p11.cpp.

628 {
629 return handle_return_value(m_func_list_ptr->C_DigestEncryptUpdate(session, part_ptr, part_len, encrypted_part_ptr,
630 encrypted_part_len_ptr), return_value);
631 }

## ◆ C_DigestFinal()

bool Botan::PKCS11::LowLevel::C_DigestFinal | ( | SessionHandle | session,
|  | Byte * | digest_ptr,
|  | Ulong * | digest_len_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_DigestFinal finishes a multiple-part message-digesting operation.

Parameters

  session | the session's handle
  digest_ptr | gets the message digest
  digest_len_ptr | gets uint8_t count of digest
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid

Returns
  true on success, false otherwise

Definition at line 500 of file p11.cpp.

504 {
505 return handle_return_value(m_func_list_ptr->C_DigestFinal(session, digest_ptr, digest_len_ptr), return_value);
506 }

## ◆ C_DigestInit()

bool Botan::PKCS11::LowLevel::C_DigestInit | ( | SessionHandle | session,
|  | Mechanism * | mechanism_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_DigestInit initializes a message-digesting operation.

Parameters

  session | the session's handle
  mechanism_ptr | the digesting mechanism
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory MechanismInvalid MechanismParamInvalid OK OperationActive PinExpired SessionClosed SessionHandleInvalid UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 467 of file p11.cpp.

470 {
471 return handle_return_value(m_func_list_ptr->C_DigestInit(session, mechanism), return_value);
472 }

## ◆ C_DigestKey()

bool Botan::PKCS11::LowLevel::C_DigestKey | ( | SessionHandle | session,
|  | ObjectHandle | key,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_DigestKey continues a multi-part message-digesting operation, by digesting the value of a secret key as part of the data already digested.

Parameters

  session | the session's handle
  key | secret key to digest
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory KeyHandleInvalid KeyIndigestible KeySizeRange OK OperationNotInitialized SessionClosed SessionHandleInvalid

Returns
  true on success, false otherwise

Definition at line 493 of file p11.cpp.

496 {
497 return handle_return_value(m_func_list_ptr->C_DigestKey(session, key), return_value);
498 }

## ◆ C_DigestUpdate()

bool Botan::PKCS11::LowLevel::C_DigestUpdate | ( | SessionHandle | session,
|  | Byte * | part_ptr,
|  | Ulong | part_len,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_DigestUpdate continues a multiple-part message-digesting operation.

Parameters

  session | the session's handle
  part_ptr | data to be digested
  part_len | bytes of data to be digested
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid

Returns
  true on success, false otherwise

Definition at line 485 of file p11.cpp.

489 {
490 return handle_return_value(m_func_list_ptr->C_DigestUpdate(session, part_ptr, part_len), return_value);
491 }

## ◆ C_Encrypt() [1/2]

bool Botan::PKCS11::LowLevel::C_Encrypt | ( | SessionHandle | session,
|  | Byte * | data_ptr,
|  | Ulong | data_len,
|  | Byte * | encrypted_data,
|  | Ulong * | encrypted_data_len_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_Encrypt encrypts single-part data.

Parameters

  session | session's handle
  data_ptr | the plaintext data
  data_len | size of plaintext data in bytes
  encrypted_data | gets ciphertext
  encrypted_data_len_ptr | gets c-text size
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized DataInvalid DataLenRange DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid

Returns
  true on success, false otherwise

Definition at line 394 of file p11.cpp.

400 {
401 return handle_return_value(m_func_list_ptr->C_Encrypt(session, data_ptr, data_len, encrypted_data_ptr,
402 encrypted_data_len_ptr), return_value);
403 }

## ◆ C_Encrypt() [2/2]

template<typename TAllocA , typename TAllocB >

bool Botan::PKCS11::LowLevel::C_Encrypt | ( | SessionHandle | session,
|  | const std::vector< uint8_t, TAllocA > & | plaintext_data,
|  | std::vector< uint8_t, TAllocB > & | encrypted_data,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const
| inline

C_Encrypt encrypts single-part data.

Parameters

  session | session's handle
  plaintext_data | the plaintext data
  encrypted_data | gets ciphertext
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized DataInvalid DataLenRange DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid

Returns
  true on success, false otherwise

Definition at line 1806 of file p11.h.

1810 {
1811 Ulong encrypted_size = 0;
1812 if(!C_Encrypt(session,
1813 const_cast<Byte*>((plaintext_data.data())),
1814 static_cast<Ulong>(plaintext_data.size()),
1815 nullptr, &encrypted_size,
1816 return_value))
1817 {
1818 return false;
1819 }
1820
1821 encrypted_data.resize(encrypted_size);
1822 if (!C_Encrypt(session,
1823 const_cast<Byte*>(plaintext_data.data()),
1824 static_cast<Ulong>(plaintext_data.size()),
1825 encrypted_data.data(),
1826 &encrypted_size, return_value))
1827 {
1828 return false;
1829 }
1830 encrypted_data.resize(encrypted_size);
1831 return true;
1832 }
Botan::PKCS11::LowLevel::C_Encrypt
bool C_Encrypt(SessionHandle session, Byte *data_ptr, Ulong data_len, Byte *encrypted_data, Ulong *encrypted_data_len_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:394

## ◆ C_EncryptFinal()

bool Botan::PKCS11::LowLevel::C_EncryptFinal | ( | SessionHandle | session,
|  | Byte * | last_encrypted_part_ptr,
|  | Ulong * | last_encrypted_part_len_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_EncryptFinal finishes a multiple-part encryption operation.

Parameters

  session | session handle
  last_encrypted_part_ptr | last c-text
  last_encrypted_part_len_ptr | gets last size
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized DataLenRange DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid

Returns
  true on success, false otherwise

Definition at line 416 of file p11.cpp.

420 {
421 return handle_return_value(m_func_list_ptr->C_EncryptFinal(session, last_encrypted_part_ptr,
422 last_encrypted_part_len_ptr), return_value);
423 }

## ◆ C_EncryptInit()

bool Botan::PKCS11::LowLevel::C_EncryptInit | ( | SessionHandle | session,
|  | Mechanism * | mechanism_ptr,
|  | ObjectHandle | key,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_EncryptInit initializes an encryption operation.

Parameters

  session | the session's handle
  mechanism_ptr | the encryption mechanism
  key | handle of encryption key
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory KeyFunctionNotPermitted KeyHandleInvalid KeySizeRange KeyTypeInconsistent MechanismInvalid MechanismParamInvalid OK OperationActive PinExpired SessionClosed SessionHandleInvalid UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 386 of file p11.cpp.

390 {
391 return handle_return_value(m_func_list_ptr->C_EncryptInit(session, mechanism_ptr, key), return_value);
392 }

## ◆ C_EncryptUpdate()

bool Botan::PKCS11::LowLevel::C_EncryptUpdate | ( | SessionHandle | session,
|  | Byte * | part_ptr,
|  | Ulong | part_len,
|  | Byte * | encrypted_part_ptr,
|  | Ulong * | encrypted_part_len_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_EncryptUpdate continues a multiple-part encryption operation.

Parameters

  session | session's handle
  part_ptr | the plaintext data
  part_len | plaintext data len
  encrypted_part_ptr | gets ciphertext
  encrypted_part_len_ptr | gets c-text size
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized DataLenRange DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid

Returns
  true on success, false otherwise

Definition at line 405 of file p11.cpp.

411 {
412 return handle_return_value(m_func_list_ptr->C_EncryptUpdate(session, part_ptr, part_len, encrypted_part_ptr,
413 encrypted_part_len_ptr), return_value);
414 }

## ◆ C_Finalize()

bool Botan::PKCS11::LowLevel::C_Finalize | ( | VoidPtr | reserved,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_Finalize indicates that an application is done with the Cryptoki library.

Parameters

  reserved | reserved. Should be nullptr
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized FunctionFailed GeneralError HostMemory OK

Returns
  true on success, false otherwise

Definition at line 91 of file p11.cpp.

93 {
94 return handle_return_value(m_func_list_ptr->C_Finalize(reserved), return_value);
95 }

## ◆ C_FindObjects()

bool Botan::PKCS11::LowLevel::C_FindObjects | ( | SessionHandle | session,
|  | ObjectHandle * | object_ptr,
|  | Ulong | max_object_count,
|  | Ulong * | object_count_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_FindObjects continues a search for token and session objects that match a template, obtaining additional object handles.

Parameters

  session | session's handle
  object_ptr | gets obj. handles
  max_object_count | max handles to get
  object_count_ptr | actual # returned
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid

Returns
  true on success, false otherwise

Definition at line 368 of file p11.cpp.

373 {
374 return handle_return_value(m_func_list_ptr->C_FindObjects(session, object_ptr, max_object_count, object_count_ptr),
375 return_value);
376 }

Referenced by Botan::PKCS11::ObjectFinder::find().

## ◆ C_FindObjectsFinal()

bool Botan::PKCS11::LowLevel::C_FindObjectsFinal | ( | SessionHandle | session,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_FindObjectsFinal finishes a search for token and session objects.

Parameters

  session | the session's handle
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid

Returns
  true on success, false otherwise

Definition at line 378 of file p11.cpp.

380 {
381 return handle_return_value(m_func_list_ptr->C_FindObjectsFinal(session), return_value);
382 }

Referenced by Botan::PKCS11::ObjectFinder::finish(), and Botan::PKCS11::ObjectFinder::~ObjectFinder().

## ◆ C_FindObjectsInit()

bool Botan::PKCS11::LowLevel::C_FindObjectsInit | ( | SessionHandle | session,
|  | Attribute * | attribute_template_ptr,
|  | Ulong | count,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_FindObjectsInit initializes a search for token and session objects that match a template.

Parameters

  session | the session's handle
  attribute_template_ptr | attribute values to match
  count | attrs in search template
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad AttributeTypeInvalid AttributeValueInvalid CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionFailed GeneralError HostMemory OK OperationActive PinExpired SessionClosed SessionHandleInvalid

Returns
  true on success, false otherwise

Definition at line 360 of file p11.cpp.

364 {
365 return handle_return_value(m_func_list_ptr->C_FindObjectsInit(session, attribute_template_ptr, count), return_value);
366 }

Referenced by Botan::PKCS11::ObjectFinder::ObjectFinder().

## ◆ C_GenerateKey()

bool Botan::PKCS11::LowLevel::C_GenerateKey | ( | SessionHandle | session,
|  | Mechanism * | mechanism_ptr,
|  | Attribute * | attribute_template_ptr,
|  | Ulong | count,
|  | ObjectHandle * | key_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_GenerateKey generates a secret key, creating a new key object.

Parameters

  session | the session's handle
  mechanism_ptr | key generation mech.
  attribute_template_ptr | template for new key
  count | # of attrs in template
  key_ptr | gets handle of new key
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad AttributeReadOnly AttributeTypeInvalid AttributeValueInvalid CryptokiNotInitialized CurveNotSupported DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory MechanismInvalid MechanismParamInvalid OK OperationActive PinExpired SessionClosed SessionHandleInvalid SessionReadOnly TemplateIncomplete TemplateInconsistent TokenWriteProtected UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 668 of file p11.cpp.

674 {
675 return handle_return_value(m_func_list_ptr->C_GenerateKey(session, mechanism_ptr, attribute_template_ptr, count,
676 key_ptr), return_value);
677 }

## ◆ C_GenerateKeyPair()

bool Botan::PKCS11::LowLevel::C_GenerateKeyPair | ( | SessionHandle | session,
|  | Mechanism * | mechanism_ptr,
|  | Attribute * | public_key_template_ptr,
|  | Ulong | public_key_attribute_count,
|  | Attribute * | private_key_template_ptr,
|  | Ulong | private_key_attribute_count,
|  | ObjectHandle * | public_key_ptr,
|  | ObjectHandle * | private_key_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_GenerateKeyPair generates a public-key/private-key pair, creating new key objects.

Parameters

  session | session handle
  mechanism_ptr | key-gen mech.
  public_key_template_ptr | template for pub. key
  public_key_attribute_count | # pub. attrs.
  private_key_template_ptr | template for priv. key
  private_key_attribute_count | # priv. attrs.
  public_key_ptr | gets pub. key handle
  private_key_ptr | gets priv. key handle
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad AttributeReadOnly AttributeTypeInvalid AttributeValueInvalid CryptokiNotInitialized CurveNotSupported DeviceError DeviceMemory DeviceRemoved DomainParamsInvalid FunctionCanceled FunctionFailed GeneralError HostMemory MechanismInvalid MechanismParamInvalid OK OperationActive PinExpired SessionClosed SessionHandleInvalid SessionReadOnly TemplateIncomplete TemplateInconsistent TokenWriteProtected UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 679 of file p11.cpp.

688 {
689 return handle_return_value(m_func_list_ptr->C_GenerateKeyPair(session, mechanism_ptr, public_key_template_ptr,
690 public_key_attribute_count, private_key_template_ptr,
691 private_key_attribute_count, public_key_ptr, private_key_ptr), return_value);
692 }

## ◆ C_GenerateRandom()

bool Botan::PKCS11::LowLevel::C_GenerateRandom | ( | SessionHandle | session,
|  | Byte * | random_data_ptr,
|  | Ulong | random_len,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_GenerateRandom generates random data.

Parameters

  session | the session's handle
  random_data_ptr | receives the random data
  random_len | # of bytes to generate
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationActive RandomNoRng SessionClosed SessionHandleInvalid UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 743 of file p11.cpp.

747 {
748 return handle_return_value(m_func_list_ptr->C_GenerateRandom(session, random_data_ptr, random_len), return_value);
749 }

Referenced by Botan::PKCS11::PKCS11_RNG::randomize().

## ◆ C_GetAttributeValue() [1/2]

bool Botan::PKCS11::LowLevel::C_GetAttributeValue | ( | SessionHandle | session,
|  | ObjectHandle | object,
|  | Attribute * | attribute_template_ptr,
|  | Ulong | count,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_GetAttributeValue obtains the value of one or more object attributes.

Parameters

  session | the session's handle
  object | the object's handle
  attribute_template_ptr | specifies attrs; gets vals
  count | attributes in template
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad AttributeSensitive AttributeTypeInvalid BufferTooSmall CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionFailed GeneralError HostMemory ObjectHandleInvalid OK SessionClosed SessionHandleInvalid

Returns
  true on success, false otherwise

Definition at line 340 of file p11.cpp.

345 {
346 return handle_return_value(m_func_list_ptr->C_GetAttributeValue(session, object, attribute_template_ptr, count),
347 return_value);
348 }

Referenced by Botan::PKCS11::Object::get_attribute_value().

## ◆ C_GetAttributeValue() [2/2]

template<typename TAlloc >

bool Botan::PKCS11::LowLevel::C_GetAttributeValue | ( | SessionHandle | session,
|  | ObjectHandle | object,
|  | std::map< AttributeType, std::vector< uint8_t, TAlloc > > & | attribute_values,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const
| inline

C_GetAttributeValue obtains the value of one or more object attributes.

Parameters

  session | the session's handle
  object | the object's handle
  attribute_values | specifies attrs; gets vals
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad AttributeSensitive AttributeTypeInvalid BufferTooSmall CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionFailed GeneralError HostMemory ObjectHandleInvalid OK SessionClosed SessionHandleInvalid

Returns
  true on success, false otherwise

Definition at line 1586 of file p11.h.

1590 {
1591 std::vector<Attribute> getter_template;
1592
1593 for(const auto& entry : attribute_values)
1594 {
1595 getter_template.emplace_back(Attribute{ static_cast< CK_ATTRIBUTE_TYPE >(entry.first), nullptr, 0 });
1596 }
1597
1598 bool success = C_GetAttributeValue(session,
1599 object,
1600 const_cast< Attribute* >(getter_template.data()),
1601 static_cast<Ulong>(getter_template.size()),
1602 return_value);
1603
1604 if(!success)
1605 {
1606 return success;
1607 }
1608
1609 size_t i = 0;
1610 for(auto& entry : attribute_values)
1611 {
1612 entry.second.clear();
1613 entry.second.resize(getter_template.at(i).ulValueLen);
1614 getter_template.at(i).pValue = const_cast< uint8_t* >(entry.second.data());
1615 i++;
1616 }
1617
1618 return C_GetAttributeValue(session, object,
1619 const_cast< Attribute* >(getter_template.data()),
1620 static_cast<Ulong>(getter_template.size()),
1621 return_value);
1622 }
Botan::PKCS11::LowLevel::C_GetAttributeValue
bool C_GetAttributeValue(SessionHandle session, ObjectHandle object, Attribute *attribute_template_ptr, Ulong count, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:340
Botan::PKCS11::Attribute
CK_ATTRIBUTE Attribute
Definition: p11.h:847
CK_ATTRIBUTE_TYPE
CK_ULONG CK_ATTRIBUTE_TYPE
Definition: pkcs11t.h:416

## ◆ C_GetFunctionList()

bool Botan::PKCS11::LowLevel::C_GetFunctionList | ( | Dynamically_Loaded_Library & | pkcs11_module,
|  | FunctionListPtr * | function_list_ptr_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  |
| static

C_GetFunctionList returns the function list.

Parameters

  pkcs11_module | The PKCS#11 module
  function_list_ptr_ptr | receives pointer to function list
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad FunctionFailed GeneralError HostMemory OK

Returns
  true on success, false otherwise

Definition at line 103 of file p11.cpp.

105 {
106 using get_function_list = CK_RV(*)(FunctionListPtr*);
107
108 get_function_list get_function_list_ptr = pkcs11_module.resolve<get_function_list>("C_GetFunctionList");
109
110 return handle_return_value(get_function_list_ptr(function_list_ptr_ptr), return_value);
111 }
Botan::PKCS11::FunctionListPtr
CK_FUNCTION_LIST_PTR FunctionListPtr
Definition: p11.h:827
CK_RV
CK_ULONG CK_RV
Definition: pkcs11t.h:1036

References Botan::Dynamically_Loaded_Library::resolve().

Referenced by Botan::PKCS11::Module::reload().

## ◆ C_GetFunctionStatus()

bool Botan::PKCS11::LowLevel::C_GetFunctionStatus | ( | SessionHandle | session,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_GetFunctionStatus is a legacy function; it obtains an updated status of a function running in parallel with an application.

Parameters

  session | the session's handle
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: CryptokiNotInitialized FunctionFailed FunctionNotParallel GeneralError HostMemory SessionHandleInvalid SessionClosed

Returns
  true on success, false otherwise

Definition at line 753 of file p11.cpp.

755 {
756 return handle_return_value(m_func_list_ptr->C_GetFunctionStatus(session), return_value);
757 }

## ◆ C_GetInfo()

bool Botan::PKCS11::LowLevel::C_GetInfo | ( | Info * | info_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_GetInfo returns general information about Cryptoki.

Parameters

  info_ptr | location that receives information
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized FunctionFailed GeneralError HostMemory OK

Returns
  true on success, false otherwise

Definition at line 97 of file p11.cpp.

99 {
100 return handle_return_value(m_func_list_ptr->C_GetInfo(info_ptr), return_value);
101 }

## ◆ C_GetMechanismInfo()

bool Botan::PKCS11::LowLevel::C_GetMechanismInfo | ( | SlotId | slot_id,
|  | MechanismType | type,
|  | MechanismInfo * | info_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_GetMechanismInfo obtains information about a particular mechanism possibly supported by a token.

Parameters

  slot_id | ID of the token's slot
  type | type of mechanism
  info_ptr | receives mechanism info
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionFailed GeneralError HostMemory MechanismInvalid OK SlotIdInvalid TokenNotPresent TokenNotRecognized ArgumentsBad

Returns
  true on success, false otherwise

Definition at line 197 of file p11.cpp.

201 {
202 return handle_return_value(m_func_list_ptr->C_GetMechanismInfo(slot_id, static_cast< CK_MECHANISM_TYPE >(type),
203 info_ptr), return_value);
204 }
type
MechanismType type
Definition: p11_mechanism.cpp:44
CK_MECHANISM_TYPE
CK_ULONG CK_MECHANISM_TYPE
Definition: pkcs11t.h:583

References type.

## ◆ C_GetMechanismList() [1/2]

bool Botan::PKCS11::LowLevel::C_GetMechanismList | ( | SlotId | slot_id,
|  | MechanismType * | mechanism_list_ptr,
|  | Ulong * | count_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_GetMechanismList obtains a list of mechanism types supported by a token.

Parameters

  slot_id | ID of token's slot
  mechanism_list_ptr | gets mech. array
  count_ptr | gets # of mechs.
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: BufferTooSmall CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionFailed GeneralError HostMemory OK SlotIdInvalid TokenNotPresent TokenNotRecognized ArgumentsBad

Returns
  true on success, false otherwise

Definition at line 166 of file p11.cpp.

170 {
171 return handle_return_value(m_func_list_ptr->C_GetMechanismList(slot_id,
172 reinterpret_cast< CK_MECHANISM_TYPE_PTR >(mechanism_list_ptr), count_ptr), return_value);
173 }
CK_MECHANISM_TYPE_PTR
CK_MECHANISM_TYPE CK_PTR CK_MECHANISM_TYPE_PTR
Definition: pkcs11t.h:977

Referenced by C_GetMechanismList().

## ◆ C_GetMechanismList() [2/2]

bool Botan::PKCS11::LowLevel::C_GetMechanismList | ( | SlotId | slot_id,
|  | std::vector< MechanismType > & | mechanisms,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_GetMechanismList obtains a list of mechanism types supported by a token.

Parameters

  slot_id | ID of token's slot
  mechanisms | receives vector of supported mechanisms
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: BufferTooSmall CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionFailed GeneralError HostMemory OK SlotIdInvalid TokenNotPresent TokenNotRecognized ArgumentsBad

Returns
  true on success, false otherwise

Definition at line 175 of file p11.cpp.

178 {
179 mechanisms.clear();
180
181 // first get number of mechanisms
182 Ulong number_mechanisms = 0;
183
184 bool success = C_GetMechanismList(slot_id, nullptr, &number_mechanisms, return_value);
185
186 if(!success || !number_mechanisms)
187 {
188 return success;
189 }
190
191 // get actual mechanisms
192 mechanisms.resize(number_mechanisms);
193 return C_GetMechanismList(slot_id, reinterpret_cast< MechanismType* >(mechanisms.data()), &number_mechanisms,
194 return_value);
195 }
Botan::PKCS11::LowLevel::C_GetMechanismList
bool C_GetMechanismList(SlotId slot_id, MechanismType *mechanism_list_ptr, Ulong *count_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:166
Botan::PKCS11::MechanismType
MechanismType
Definition: p11.h:338

References C_GetMechanismList().

## ◆ C_GetObjectSize()

bool Botan::PKCS11::LowLevel::C_GetObjectSize | ( | SessionHandle | session,
|  | ObjectHandle | object,
|  | Ulong * | size_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_GetObjectSize gets the size of an object in bytes.

Parameters

  session | the session's handle
  object | the object's handle
  size_ptr | receives size of object
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionFailed GeneralError HostMemory InformationSensitive ObjectHandleInvalid OK SessionClosed SessionHandleInvalid

Returns
  true on success, false otherwise

Definition at line 332 of file p11.cpp.

336 {
337 return handle_return_value(m_func_list_ptr->C_GetObjectSize(session, object, size_ptr), return_value);
338 }

## ◆ C_GetOperationState()

bool Botan::PKCS11::LowLevel::C_GetOperationState | ( | SessionHandle | session,
|  | Byte * | operation_state_ptr,
|  | Ulong * | operation_state_len_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_GetOperationState obtains the state of the cryptographic operation in a session.

Parameters

  session | session's handle
  operation_state_ptr | gets state
  operation_state_len_ptr | gets state length
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: BufferTooSmall CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid StateUnsaveable ArgumentsBad

Returns
  true on success, false otherwise

Definition at line 266 of file p11.cpp.

270 {
271 return handle_return_value(m_func_list_ptr->C_GetOperationState(session, operation_state_ptr, operation_state_len_ptr),
272 return_value);
273 }

## ◆ C_GetSessionInfo()

bool Botan::PKCS11::LowLevel::C_GetSessionInfo | ( | SessionHandle | session,
|  | SessionInfo * | info_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_GetSessionInfo obtains information about the session.

Parameters

  session | the session's handle
  info_ptr | receives session info
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionFailed GeneralError HostMemory OK SessionClosed SessionHandleInvalid ArgumentsBad

Returns
  true on success, false otherwise

Definition at line 259 of file p11.cpp.

262 {
263 return handle_return_value(m_func_list_ptr->C_GetSessionInfo(session, info_ptr), return_value);
264 }

Referenced by Botan::PKCS11::Session::get_info().

## ◆ C_GetSlotInfo()

bool Botan::PKCS11::LowLevel::C_GetSlotInfo | ( | SlotId | slot_id,
|  | SlotInfo * | info_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_GetSlotInfo obtains information about a particular slot in the system.

Parameters

  slot_id | the ID of the slot
  info_ptr | receives the slot information
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized DeviceError FunctionFailed GeneralError HostMemory OK SlotIdInvalid

Returns
  true on success, false otherwise

Definition at line 144 of file p11.cpp.

147 {
148 return handle_return_value(m_func_list_ptr->C_GetSlotInfo(slot_id, info_ptr), return_value);
149 }

## ◆ C_GetSlotList() [1/2]

bool Botan::PKCS11::LowLevel::C_GetSlotList | ( | Bbool | token_present,
|  | SlotId * | slot_list_ptr,
|  | Ulong * | count_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_GetSlotList obtains a list of slots in the system.

Parameters

  token_present | only slots with tokens
  slot_list_ptr | receives array of slot IDs
  count_ptr | receives number of slots
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized FunctionFailed GeneralError HostMemory OK

Returns
  true on success, false otherwise

Definition at line 115 of file p11.cpp.

119 {
120 return handle_return_value(m_func_list_ptr->C_GetSlotList(token_present, slot_list_ptr, count_ptr), return_value);
121 }

Referenced by C_GetSlotList(), and Botan::PKCS11::Slot::get_available_slots().

## ◆ C_GetSlotList() [2/2]

bool Botan::PKCS11::LowLevel::C_GetSlotList | ( | bool | token_present,
|  | std::vector< SlotId > & | slot_ids,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_GetSlotList obtains a list of slots in the system.

Parameters

  token_present | only slots with tokens
  slot_ids | receives vector of slot IDs
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized FunctionFailed GeneralError HostMemory OK

Returns
  true on success, false otherwise

Definition at line 123 of file p11.cpp.

126 {
127 slot_ids.clear();
128
129 // first get available slots
130 Ulong number_slots = 0;
131
132 bool success = C_GetSlotList(token_present, nullptr, &number_slots, return_value);
133
134 if(!success || !number_slots)
135 {
136 return success;
137 }
138
139 // get actual slot ids
140 slot_ids.resize(number_slots);
141 return C_GetSlotList(token_present, slot_ids.data(), &number_slots, return_value);
142 }
Botan::PKCS11::LowLevel::C_GetSlotList
bool C_GetSlotList(Bbool token_present, SlotId *slot_list_ptr, Ulong *count_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:115

References C_GetSlotList().

## ◆ C_GetTokenInfo()

bool Botan::PKCS11::LowLevel::C_GetTokenInfo | ( | SlotId | slot_id,
|  | TokenInfo * | info_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_GetTokenInfo obtains information about a particular token in the system.

Parameters

  slot_id | ID of the token's slot
  info_ptr | receives the token information
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionFailed GeneralError HostMemory OK SlotIdInvalid TokenNotPresent TokenNotRecognized ArgumentsBad

Returns
  true on success, false otherwise

Definition at line 151 of file p11.cpp.

154 {
155 return handle_return_value(m_func_list_ptr->C_GetTokenInfo(slot_id, info_ptr), return_value);
156 }

## ◆ C_Initialize()

bool Botan::PKCS11::LowLevel::C_Initialize | ( | VoidPtr | init_args,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_Initialize initializes the Cryptoki library.

Parameters

  init_args | if this is not nullptr, it gets cast to (`C_InitializeArgs`) and dereferenced
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CantLock CryptokiAlreadyInitialized FunctionFailed GeneralError HostMemory NeedToCreateThreads OK

Returns
  true on success, false otherwise

Definition at line 85 of file p11.cpp.

87 {
88 return handle_return_value(m_func_list_ptr->C_Initialize(init_args), return_value);
89 }

## ◆ C_InitPIN() [1/2]

template<typename TAlloc >

bool Botan::PKCS11::LowLevel::C_InitPIN | ( | SessionHandle | session,
|  | const std::vector< uint8_t, TAlloc > & | pin,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const
| inline

C_InitPIN initializes the normal user's PIN.

Parameters

  session | the session's handle
  pin | the normal user's PIN
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK PinInvalid PinLenRange SessionClosed SessionReadOnly SessionHandleInvalid TokenWriteProtected UserNotLoggedIn ArgumentsBad

Returns
  true on success, false otherwise

Definition at line 1205 of file p11.h.

1208 {
1209 return C_InitPIN(session,
1210 reinterpret_cast< Utf8Char* >(const_cast< uint8_t* >(pin.data())),
1211 static_cast<Ulong>(pin.size()),
1212 return_value);
1213 }
Botan::PKCS11::LowLevel::C_InitPIN
bool C_InitPIN(SessionHandle session, Utf8Char *pin_ptr, Ulong pin_len, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:215
Botan::PKCS11::Utf8Char
CK_UTF8CHAR Utf8Char
Definition: p11.h:843

## ◆ C_InitPIN() [2/2]

bool Botan::PKCS11::LowLevel::C_InitPIN | ( | SessionHandle | session,
|  | Utf8Char * | pin_ptr,
|  | Ulong | pin_len,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_InitPIN initializes the normal user's PIN.

Parameters

  session | the session's handle
  pin_ptr | the normal user's PIN
  pin_len | length in bytes of the PIN
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK PinInvalid PinLenRange SessionClosed SessionReadOnly SessionHandleInvalid TokenWriteProtected UserNotLoggedIn ArgumentsBad

Returns
  true on success, false otherwise

Definition at line 215 of file p11.cpp.

219 {
220 return handle_return_value(m_func_list_ptr->C_InitPIN(session, pin_ptr, pin_len), return_value);
221 }

Referenced by Botan::PKCS11::Session::init_pin().

## ◆ C_InitToken() [1/2]

template<typename TAlloc >

bool Botan::PKCS11::LowLevel::C_InitToken | ( | SlotId | slot_id,
|  | const std::vector< uint8_t, TAlloc > & | so_pin,
|  | const std::string & | label,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const
| inline

C_InitToken initializes a token.

Parameters

  slot_id | ID of the token's slot
  so_pin | the SO's initial PIN
  label | token label (at max 32 bytes long)
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK PinIncorrect PinLocked SessionExists SlotIdInvalid TokenNotPresent TokenNotRecognized TokenWriteProtected ArgumentsBad

Returns
  true on success, false otherwise

Definition at line 1150 of file p11.h.

1154 {
1155 std::string padded_label = label;
1156 if(label.size() < 32)
1157 {
1158 padded_label.insert(padded_label.end(), 32 - label.size(), ' ');
1159 }
1160
1161 return C_InitToken(slot_id,
1162 reinterpret_cast< Utf8Char* >(const_cast< uint8_t* >(so_pin.data())),
1163 static_cast<Ulong>(so_pin.size()),
1164 reinterpret_cast< Utf8Char* >(const_cast< char* >(padded_label.c_str())),
1165 return_value);
1166 }
Botan::PKCS11::LowLevel::C_InitToken
bool C_InitToken(SlotId slot_id, Utf8Char *so_pin_ptr, Ulong so_pin_len, Utf8Char *label_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:206

## ◆ C_InitToken() [2/2]

bool Botan::PKCS11::LowLevel::C_InitToken | ( | SlotId | slot_id,
|  | Utf8Char * | so_pin_ptr,
|  | Ulong | so_pin_len,
|  | Utf8Char * | label_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_InitToken initializes a token.

Parameters

  slot_id | ID of the token's slot
  so_pin_ptr | the SO's initial PIN
  so_pin_len | length in bytes of the SO_PIN
  label_ptr | 32-byte token label (blank padded)
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK PinIncorrect PinLocked SessionExists SlotIdInvalid TokenNotPresent TokenNotRecognized TokenWriteProtected ArgumentsBad

Returns
  true on success, false otherwise

Definition at line 206 of file p11.cpp.

211 {
212 return handle_return_value(m_func_list_ptr->C_InitToken(slot_id, so_pin_ptr, so_pin_len, label_ptr), return_value);
213 }

## ◆ C_Login() [1/2]

template<typename TAlloc >

bool Botan::PKCS11::LowLevel::C_Login | ( | SessionHandle | session,
|  | UserType | user_type,
|  | const std::vector< uint8_t, TAlloc > & | pin,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const
| inline

C_Login logs a user into a token.

Parameters

  session | the session's handle
  user_type | the user type
  pin | the user or security officer's PIN
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized PinIncorrect PinLocked SessionClosed SessionHandleInvalid SessionReadOnlyExists UserAlreadyLoggedIn UserAnotherAlreadyLoggedIn UserPinNotInitialized UserTooManyTypes UserTypeInvalid

Returns
  true on success, false otherwise

Definition at line 1431 of file p11.h.

1435 {
1436 return C_Login(session, user_type,
1437 reinterpret_cast< Utf8Char* >(const_cast< uint8_t* >(pin.data())),
1438 static_cast<Ulong>(pin.size()),
1439 return_value);
1440 }
Botan::PKCS11::LowLevel::C_Login
bool C_Login(SessionHandle session, UserType user_type, Utf8Char *pin_ptr, Ulong pin_len, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:286

## ◆ C_Login() [2/2]

bool Botan::PKCS11::LowLevel::C_Login | ( | SessionHandle | session,
|  | UserType | user_type,
|  | Utf8Char * | pin_ptr,
|  | Ulong | pin_len,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_Login logs a user into a token.

Parameters

  session | the session's handle
  user_type | the user type
  pin_ptr | the user's PIN
  pin_len | the length of the PIN
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized PinIncorrect PinLocked SessionClosed SessionHandleInvalid SessionReadOnlyExists UserAlreadyLoggedIn UserAnotherAlreadyLoggedIn UserPinNotInitialized UserTooManyTypes UserTypeInvalid

Returns
  true on success, false otherwise

Definition at line 286 of file p11.cpp.

291 {
292 return handle_return_value(m_func_list_ptr->C_Login(session, static_cast< CK_USER_TYPE >(user_type), pin_ptr, pin_len),
293 return_value);
294 }
CK_USER_TYPE
CK_ULONG CK_USER_TYPE
Definition: pkcs11t.h:262

Referenced by Botan::PKCS11::Session::login().

## ◆ C_Logout()

bool Botan::PKCS11::LowLevel::C_Logout | ( | SessionHandle | session,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_Logout logs a user out from a token.

Parameters

  session | the session's handle
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionFailed GeneralError HostMemory OK SessionClosed SessionHandleInvalid UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 296 of file p11.cpp.

298 {
299 return handle_return_value(m_func_list_ptr->C_Logout(session), return_value);
300 }

Referenced by Botan::PKCS11::Session::logoff(), and Botan::PKCS11::Session::~Session().

## ◆ C_OpenSession()

bool Botan::PKCS11::LowLevel::C_OpenSession | ( | SlotId | slot_id,
|  | Flags | flags,
|  | VoidPtr | application,
|  | Notify | notify,
|  | SessionHandle * | session_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_OpenSession opens a session between an application and a token.

Parameters

  slot_id | the slot's ID
  flags | from CK_SESSION_INFO
  application | passed to callback
  notify | callback function
  session_ptr | gets session handle
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionFailed GeneralError HostMemory OK SessionCount SessionParallelNotSupported SessionReadWriteSoExists SlotIdInvalid TokenNotPresent TokenNotRecognized TokenWriteProtected ArgumentsBad

Returns
  true on success, false otherwise

Definition at line 236 of file p11.cpp.

242 {
243 return handle_return_value(m_func_list_ptr->C_OpenSession(slot_id, flags, application, notify, session_ptr),
244 return_value);
245 }
Botan::PKCS11::flags
Flags flags(Flag flags)
Definition: p11.h:860

References Botan::PKCS11::flags().

Referenced by Botan::PKCS11::Session::Session().

## ◆ C_SeedRandom()

bool Botan::PKCS11::LowLevel::C_SeedRandom | ( | SessionHandle | session,
|  | Byte * | seed_ptr,
|  | Ulong | seed_len,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_SeedRandom mixes additional seed material into the token's random number generator.

Parameters

  session | the session's handle
  seed_ptr | the seed material
  seed_len | length of seed material
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationActive RandomSeedNotSupported RandomNoRng SessionClosed SessionHandleInvalid UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 735 of file p11.cpp.

739 {
740 return handle_return_value(m_func_list_ptr->C_SeedRandom(session, seed_ptr, seed_len), return_value);
741 }

Referenced by Botan::PKCS11::PKCS11_RNG::add_entropy().

## ◆ C_SetAttributeValue() [1/2]

bool Botan::PKCS11::LowLevel::C_SetAttributeValue | ( | SessionHandle | session,
|  | ObjectHandle | object,
|  | Attribute * | attribute_template_ptr,
|  | Ulong | count,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_SetAttributeValue modifies the value of one or more object attributes.

Parameters

  session | the session's handle
  object | the object's handle
  attribute_template_ptr | specifies attrs and values
  count | attributes in template
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ActionProhibited ArgumentsBad AttributeReadOnly AttributeTypeInvalid AttributeValueInvalid CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionFailed GeneralError HostMemory ObjectHandleInvalid OK SessionClosed SessionHandleInvalid SessionReadOnly TemplateInconsistent TokenWriteProtected UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 350 of file p11.cpp.

355 {
356 return handle_return_value(m_func_list_ptr->C_SetAttributeValue(session, object, attribute_template_ptr, count),
357 return_value);
358 }

Referenced by Botan::PKCS11::Object::set_attribute_value().

## ◆ C_SetAttributeValue() [2/2]

template<typename TAlloc >

bool Botan::PKCS11::LowLevel::C_SetAttributeValue | ( | SessionHandle | session,
|  | ObjectHandle | object,
|  | std::map< AttributeType, std::vector< uint8_t, TAlloc > > & | attribute_values,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const
| inline

C_SetAttributeValue modifies the value of one or more object attributes.

Parameters

  session | the session's handle
  object | the object's handle
  attribute_values | specifies attrs and values
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ActionProhibited ArgumentsBad AttributeReadOnly AttributeTypeInvalid AttributeValueInvalid CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionFailed GeneralError HostMemory ObjectHandleInvalid OK SessionClosed SessionHandleInvalid SessionReadOnly TemplateInconsistent TokenWriteProtected UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 1666 of file p11.h.

1670 {
1671 std::vector<Attribute> setter_template;
1672
1673 for(auto& entry : attribute_values)
1674 {
1675 setter_template.emplace_back(Attribute{ static_cast< CK_ATTRIBUTE_TYPE >(entry.first), entry.second.data(), static_cast<CK_ULONG>(entry.second.size()) });
1676 }
1677
1678 return C_SetAttributeValue(session, object,
1679 const_cast< Attribute* >(setter_template.data()),
1680 static_cast<Ulong>(setter_template.size()),
1681 return_value);
1682 }
Botan::PKCS11::LowLevel::C_SetAttributeValue
bool C_SetAttributeValue(SessionHandle session, ObjectHandle object, Attribute *attribute_template_ptr, Ulong count, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:350
CK_ULONG
unsigned long int CK_ULONG
Definition: pkcs11t.h:48

## ◆ C_SetOperationState()

bool Botan::PKCS11::LowLevel::C_SetOperationState | ( | SessionHandle | session,
|  | Byte * | operation_state_ptr,
|  | Ulong | operation_state_len,
|  | ObjectHandle | encryption_key,
|  | ObjectHandle | authentication_key,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_SetOperationState restores the state of the cryptographic operation in a session.

Parameters

  session | session's handle
  operation_state_ptr | holds state
  operation_state_len | holds state length
  encryption_key | en/decryption key
  authentication_key | sign/verify key
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionFailed GeneralError HostMemory KeyChanged KeyNeeded KeyNotNeeded OK SavedStateInvalid SessionClosed SessionHandleInvalid ArgumentsBad

Returns
  true on success, false otherwise

Definition at line 275 of file p11.cpp.

281 {
282 return handle_return_value(m_func_list_ptr->C_SetOperationState(session, operation_state_ptr, operation_state_len,
283 encryption_key, authentication_key), return_value);
284 }

## ◆ C_SetPIN() [1/2]

template<typename TAlloc >

bool Botan::PKCS11::LowLevel::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
| inline

C_SetPIN modifies the PIN of the user who is logged in.

Parameters

  session | the session's handle
  old_pin | the old PIN
  new_pin | the new PIN
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK PinIncorrect PinInvalid PinLenRange PinLocked SessionClosed SessionHandleInvalid SessionReadOnly TokenWriteProtected ArgumentsBad

Returns
  true on success, false otherwise

Definition at line 1257 of file p11.h.

1261 {
1262 return C_SetPIN(session,
1263 reinterpret_cast< Utf8Char* >(const_cast< uint8_t* >(old_pin.data())),
1264 static_cast<Ulong>(old_pin.size()),
1265 reinterpret_cast< Utf8Char* >(const_cast< uint8_t* >(new_pin.data())),
1266 static_cast<Ulong>(new_pin.size()),
1267 return_value);
1268 }
Botan::PKCS11::LowLevel::C_SetPIN
bool C_SetPIN(SessionHandle session, Utf8Char *old_pin_ptr, Ulong old_len, Utf8Char *new_pin_ptr, Ulong new_len, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:223

## ◆ C_SetPIN() [2/2]

bool Botan::PKCS11::LowLevel::C_SetPIN | ( | SessionHandle | session,
|  | Utf8Char * | old_pin_ptr,
|  | Ulong | old_len,
|  | Utf8Char * | new_pin_ptr,
|  | Ulong | new_len,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_SetPIN modifies the PIN of the user who is logged in.

Parameters

  session | the session's handle
  old_pin_ptr | the old PIN
  old_len | length of the old PIN
  new_pin_ptr | the new PIN
  new_len | length of the new PIN
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK PinIncorrect PinInvalid PinLenRange PinLocked SessionClosed SessionHandleInvalid SessionReadOnly TokenWriteProtected ArgumentsBad

Returns
  true on success, false otherwise

Definition at line 223 of file p11.cpp.

229 {
230 return handle_return_value(m_func_list_ptr->C_SetPIN(session, old_pin_ptr, old_len, new_pin_ptr, new_len),
231 return_value);
232 }

Referenced by Botan::PKCS11::Session::set_pin().

## ◆ C_Sign() [1/2]

bool Botan::PKCS11::LowLevel::C_Sign | ( | SessionHandle | session,
|  | Byte * | data_ptr,
|  | Ulong | data_len,
|  | Byte * | signature_ptr,
|  | Ulong * | signature_len_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_Sign signs (encrypts with private key) data in a single part, where the signature is (will be) an appendix to the data, and plaintext cannot be recovered from the signature.

Parameters

  session | the session's handle
  data_ptr | the data to sign
  data_len | count of bytes to sign
  signature_ptr | gets the signature
  signature_len_ptr | gets signature length
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized DataInvalid DataLenRange DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid UserNotLoggedIn FunctionRejected

Returns
  true on success, false otherwise

Definition at line 518 of file p11.cpp.

524 {
525 return handle_return_value(m_func_list_ptr->C_Sign(session, data_ptr, data_len, signature_ptr, signature_len_ptr),
526 return_value);
527 }

## ◆ C_Sign() [2/2]

template<typename TAllocA , typename TAllocB >

bool Botan::PKCS11::LowLevel::C_Sign | ( | SessionHandle | session,
|  | const std::vector< uint8_t, TAllocA > & | data,
|  | std::vector< uint8_t, TAllocB > & | signature,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const
| inline

C_Sign signs (encrypts with private key) data in a single part, where the signature is (will be) an appendix to the data, and plaintext cannot be recovered from the signature.

Parameters

  session | the session's handle
  data | the data to sign
  signature | gets the signature
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized DataInvalid DataLenRange DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid UserNotLoggedIn FunctionRejected

Returns
  true on success, false otherwise

Definition at line 2187 of file p11.h.

2191 {
2192 Ulong signature_size = 0;
2193 if(!C_Sign(session,
2194 const_cast<Byte*>((data.data())),
2195 static_cast<Ulong>(data.size()),
2196 nullptr,
2197 &signature_size,
2198 return_value))
2199 {
2200 return false;
2201 }
2202
2203 signature.resize(signature_size);
2204 if (!C_Sign(session,
2205 const_cast<Byte*>(data.data()),
2206 static_cast<Ulong>(data.size()),
2207 signature.data(),
2208 &signature_size,
2209 return_value))
2210 {
2211 return false;
2212 }
2213 signature.resize(signature_size);
2214 return true;
2215 }
Botan::PKCS11::LowLevel::C_Sign
bool C_Sign(SessionHandle session, Byte *data_ptr, Ulong data_len, Byte *signature_ptr, Ulong *signature_len_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:518

## ◆ C_SignEncryptUpdate()

bool Botan::PKCS11::LowLevel::C_SignEncryptUpdate | ( | SessionHandle | session,
|  | Byte * | part_ptr,
|  | Ulong | part_len,
|  | Byte * | encrypted_part_ptr,
|  | Ulong * | encrypted_part_len_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_SignEncryptUpdate continues a multiple-part signing and encryption operation.

Parameters

  session | session's handle
  part_ptr | the plaintext data
  part_len | plaintext length
  encrypted_part_ptr | gets ciphertext
  encrypted_part_len_ptr | gets c-text length
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized DataLenRange DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 644 of file p11.cpp.

650 {
651 return handle_return_value(m_func_list_ptr->C_SignEncryptUpdate(session, part_ptr, part_len, encrypted_part_ptr,
652 encrypted_part_len_ptr), return_value);
653 }

## ◆ C_SignFinal() [1/2]

bool Botan::PKCS11::LowLevel::C_SignFinal | ( | SessionHandle | session,
|  | Byte * | signature_ptr,
|  | Ulong * | signature_len_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_SignFinal finishes a multiple-part signature operation, returning the signature.

Parameters

  session | the session's handle
  signature_ptr | gets the signature
  signature_len_ptr | gets signature length
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized DataLenRange DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid UserNotLoggedIn FunctionRejected

Returns
  true on success, false otherwise

Definition at line 537 of file p11.cpp.

541 {
542 return handle_return_value(m_func_list_ptr->C_SignFinal(session, signature_ptr, signature_len_ptr), return_value);
543 }

## ◆ C_SignFinal() [2/2]

template<typename TAlloc >

bool Botan::PKCS11::LowLevel::C_SignFinal | ( | SessionHandle | session,
|  | std::vector< uint8_t, TAlloc > & | signature,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const
| inline

C_SignFinal finishes a multiple-part signature operation, returning the signature.

Parameters

  session | the session's handle
  signature | gets the signature
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized DataLenRange DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid UserNotLoggedIn FunctionRejected

Returns
  true on success, false otherwise

Definition at line 2299 of file p11.h.

2302 {
2303 Ulong signature_size = 0;
2304 if(!C_SignFinal(session, nullptr, &signature_size, return_value))
2305 {
2306 return false;
2307 }
2308
2309 signature.resize(signature_size);
2310 if (!C_SignFinal(session, signature.data(), &signature_size, return_value))
2311 {
2312 return false;
2313 }
2314 signature.resize(signature_size);
2315 return true;
2316 }
Botan::PKCS11::LowLevel::C_SignFinal
bool C_SignFinal(SessionHandle session, Byte *signature_ptr, Ulong *signature_len_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:537

## ◆ C_SignInit()

bool Botan::PKCS11::LowLevel::C_SignInit | ( | SessionHandle | session,
|  | Mechanism * | mechanism_ptr,
|  | ObjectHandle | key,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_SignInit initializes a signature (private key encryption) operation, where the signature is (will be) an appendix to the data, and plaintext cannot be recovered from the signature.

Parameters

  session | the session's handle
  mechanism_ptr | the signature mechanism
  key | handle of signature key
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory KeyFunctionNotPermitted KeyHandleInvalid KeySizeRange KeyTypeInconsistent MechanismInvalid MechanismParamInvalid OK OperationActive PinExpired SessionClosed SessionHandleInvalid UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 510 of file p11.cpp.

514 {
515 return handle_return_value(m_func_list_ptr->C_SignInit(session, mechanism_ptr, key), return_value);
516 }

## ◆ C_SignRecover()

bool Botan::PKCS11::LowLevel::C_SignRecover | ( | SessionHandle | session,
|  | Byte * | data_ptr,
|  | Ulong | data_len,
|  | Byte * | signature_ptr,
|  | Ulong * | signature_len_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_SignRecover signs data in a single operation, where the data can be recovered from the signature.

Parameters

  session | the session's handle
  data_ptr | the data to sign
  data_len | count of bytes to sign
  signature_ptr | gets the signature
  signature_len_ptr | gets signature length
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized DataInvalid DataLenRange DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 553 of file p11.cpp.

559 {
560 return handle_return_value(m_func_list_ptr->C_SignRecover(session, data, data_len, signature, signature_len),
561 return_value);
562 }

## ◆ C_SignRecoverInit()

bool Botan::PKCS11::LowLevel::C_SignRecoverInit | ( | SessionHandle | session,
|  | Mechanism * | mechanism_ptr,
|  | ObjectHandle | key,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_SignRecoverInit initializes a signature operation, where the data can be recovered from the signature.

Parameters

  session | the session's handle
  mechanism_ptr | the signature mechanism
  key | handle of the signature key
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory KeyFunctionNotPermitted KeyHandleInvalid KeySizeRange KeyTypeInconsistent MechanismInvalid MechanismParamInvalid OK OperationActive PinExpired SessionClosed SessionHandleInvalid UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 545 of file p11.cpp.

549 {
550 return handle_return_value(m_func_list_ptr->C_SignRecoverInit(session, mechanism_ptr, key), return_value);
551 }

## ◆ C_SignUpdate() [1/2]

bool Botan::PKCS11::LowLevel::C_SignUpdate | ( | SessionHandle | session,
|  | Byte * | part_ptr,
|  | Ulong | part_len,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_SignUpdate continues a multiple-part signature operation, where the signature is (will be) an appendix to the data, and plaintext cannot be recovered from the signature.

Parameters

  session | the session's handle
  part_ptr | the data to sign
  part_len | count of bytes to sign
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized DataLenRange DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 529 of file p11.cpp.

533 {
534 return handle_return_value(m_func_list_ptr->C_SignUpdate(session, part_ptr, part_len), return_value);
535 }

## ◆ C_SignUpdate() [2/2]

template<typename TAlloc >

bool Botan::PKCS11::LowLevel::C_SignUpdate | ( | SessionHandle | session,
|  | const std::vector< uint8_t, TAlloc > & | part,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const
| inline

C_SignUpdate continues a multiple-part signature operation, where the signature is (will be) an appendix to the data, and plaintext cannot be recovered from the signature.

Parameters

  session | the session's handle
  part | the data to sign
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized DataLenRange DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 2252 of file p11.h.

2255 {
2256 return C_SignUpdate(session,
2257 const_cast<Byte*>(part.data()),
2258 static_cast<Ulong>(part.size()),
2259 return_value);
2260 }
Botan::PKCS11::LowLevel::C_SignUpdate
bool C_SignUpdate(SessionHandle session, Byte *part_ptr, Ulong part_len, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:529

## ◆ C_UnwrapKey()

bool Botan::PKCS11::LowLevel::C_UnwrapKey | ( | SessionHandle | session,
|  | Mechanism * | mechanism_ptr,
|  | ObjectHandle | unwrapping_key,
|  | Byte * | wrapped_key_ptr,
|  | Ulong | wrapped_key_len,
|  | Attribute * | attribute_template_ptr,
|  | Ulong | attribute_count,
|  | ObjectHandle * | key_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new key object.

Parameters

  session | session's handle
  mechanism_ptr | unwrapping mech.
  unwrapping_key | unwrapping key
  wrapped_key_ptr | the wrapped key
  wrapped_key_len | wrapped key len
  attribute_template_ptr | new key template
  attribute_count | template length
  key_ptr | gets new handle
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad AttributeReadOnly AttributeTypeInvalid AttributeValueInvalid BufferTooSmall CryptokiNotInitialized CurveNotSupported DeviceError DeviceMemory DeviceRemoved DomainParamsInvalid FunctionCanceled FunctionFailed GeneralError HostMemory MechanismInvalid MechanismParamInvalid OK OperationActive PinExpired SessionClosed SessionHandleInvalid SessionReadOnly TemplateIncomplete TemplateInconsistent TokenWriteProtected UnwrappingKeyHandleInvalid UnwrappingKeySizeRange UnwrappingKeyTypeInconsistent UserNotLoggedIn WrappedKeyInvalid WrappedKeyLenRange

Returns
  true on success, false otherwise

Definition at line 706 of file p11.cpp.

715 {
716 return handle_return_value(m_func_list_ptr->C_UnwrapKey(session, mechanism_ptr, unwrapping_key, wrapped_key_ptr,
717 wrapped_key_len, attribute_template_ptr,
718 attribute_count, key_ptr), return_value);
719 }

## ◆ C_Verify() [1/2]

bool Botan::PKCS11::LowLevel::C_Verify | ( | SessionHandle | session,
|  | Byte * | data_ptr,
|  | Ulong | data_len,
|  | Byte * | signature_ptr,
|  | Ulong | signature_len,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_Verify verifies a signature in a single-part operation, where the signature is an appendix to the data, and plaintext cannot be recovered from the signature.

Parameters

  session | the session's handle
  data_ptr | signed data
  data_len | length of signed data
  signature_ptr | signature
  signature_len | signature length
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized DataInvalid DataLenRange DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid SignatureInvalid SignatureLenRange

Returns
  true on success, false otherwise

Definition at line 574 of file p11.cpp.

580 {
581 return handle_return_value(m_func_list_ptr->C_Verify(session, data_ptr, data_len, signature_ptr, signature_len),
582 return_value);
583 }

## ◆ C_Verify() [2/2]

template<typename TAllocA , typename TAllocB >

bool Botan::PKCS11::LowLevel::C_Verify | ( | SessionHandle | session,
|  | const std::vector< uint8_t, TAllocA > & | data,
|  | std::vector< uint8_t, TAllocB > & | signature,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const
| inline

C_Verify verifies a signature in a single-part operation, where the signature is an appendix to the data, and plaintext cannot be recovered from the signature.

Parameters

  session | the session's handle
  data | signed data
  signature | signature
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized DataInvalid DataLenRange DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid SignatureInvalid SignatureLenRange

Returns
  true on success, false otherwise

Definition at line 2431 of file p11.h.

2435 {
2436 return C_Verify(session,
2437 const_cast<Byte*>(data.data()),
2438 static_cast<Ulong>(data.size()),
2439 signature.data(),
2440 static_cast<Ulong>(signature.size()),
2441 return_value);
2442 }
Botan::PKCS11::LowLevel::C_Verify
bool C_Verify(SessionHandle session, Byte *data_ptr, Ulong data_len, Byte *signature_ptr, Ulong signature_len, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:574

## ◆ C_VerifyFinal()

bool Botan::PKCS11::LowLevel::C_VerifyFinal | ( | SessionHandle | session,
|  | Byte * | signature_ptr,
|  | Ulong | signature_len,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_VerifyFinal finishes a multiple-part verification operation, checking the signature.

Parameters

  session | the session's handle
  signature_ptr | signature to verify
  signature_len | signature length
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized DataLenRange DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid SignatureInvalid SignatureLenRange

Returns
  true on success, false otherwise

Definition at line 593 of file p11.cpp.

597 {
598 return handle_return_value(m_func_list_ptr->C_VerifyFinal(session, signature_ptr, signature_len), return_value);
599 }

## ◆ C_VerifyInit()

bool Botan::PKCS11::LowLevel::C_VerifyInit | ( | SessionHandle | session,
|  | Mechanism * | mechanism_ptr,
|  | ObjectHandle | key,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_VerifyInit initializes a verification operation, where the signature is an appendix to the data, and plaintext cannot be recovered from the signature (e.g. DSA).

Parameters

  session | the session's handle
  mechanism_ptr | the verification mechanism
  key | verification key
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory KeyFunctionNotPermitted KeyHandleInvalid KeySizeRange KeyTypeInconsistent MechanismInvalid MechanismParamInvalid OK OperationActive PinExpired SessionClosed SessionHandleInvalid UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 566 of file p11.cpp.

570 {
571 return handle_return_value(m_func_list_ptr->C_VerifyInit(session, mechanism_ptr, key), return_value);
572 }

## ◆ C_VerifyRecover()

bool Botan::PKCS11::LowLevel::C_VerifyRecover | ( | SessionHandle | session,
|  | Byte * | signature_ptr,
|  | Ulong | signature_len,
|  | Byte * | data_ptr,
|  | Ulong * | data_len_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_VerifyRecover verifies a signature in a single-part operation, where the data is recovered from the signature.

Parameters

  session | the session's handle
  signature_ptr | signature to verify
  signature_len | signature length
  data_ptr | gets signed data
  data_len_ptr | gets signed data len
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized DataInvalid DataLenRange DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid SignatureLenRange SignatureInvalid

Returns
  true on success, false otherwise

Definition at line 609 of file p11.cpp.

615 {
616 return handle_return_value(m_func_list_ptr->C_VerifyRecover(session, signature_ptr, signature_len, data_ptr,
617 data_len_ptr), return_value);
618 }

## ◆ C_VerifyRecoverInit()

bool Botan::PKCS11::LowLevel::C_VerifyRecoverInit | ( | SessionHandle | session,
|  | Mechanism * | mechanism_ptr,
|  | ObjectHandle | key,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_VerifyRecoverInit initializes a signature verification operation, where the data is recovered from the signature.

Parameters

  session | the session's handle
  mechanism_ptr | the verification mechanism
  key | verification key
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory KeyFunctionNotPermitted KeyHandleInvalid KeySizeRange KeyTypeInconsistent MechanismInvalid MechanismParamInvalid OK OperationActive PinExpired SessionClosed SessionHandleInvalid UserNotLoggedIn

Returns
  true on success, false otherwise

Definition at line 601 of file p11.cpp.

605 {
606 return handle_return_value(m_func_list_ptr->C_VerifyRecoverInit(session, mechanism_ptr, key), return_value);
607 }

## ◆ C_VerifyUpdate() [1/2]

bool Botan::PKCS11::LowLevel::C_VerifyUpdate | ( | SessionHandle | session,
|  | Byte * | part_ptr,
|  | Ulong | part_len,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_VerifyUpdate continues a multiple-part verification operation, where the signature is an appendix to the data, and plaintext cannot be recovered from the signature.

Parameters

  session | the session's handle
  part_ptr | signed data
  part_len | length of signed data
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized DataLenRange DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid

Returns
  true on success, false otherwise

Definition at line 585 of file p11.cpp.

589 {
590 return handle_return_value(m_func_list_ptr->C_VerifyUpdate(session, part_ptr, part_len), return_value);
591 }

## ◆ C_VerifyUpdate() [2/2]

template<typename TAlloc >

bool Botan::PKCS11::LowLevel::C_VerifyUpdate | ( | SessionHandle | session,
|  | std::vector< uint8_t, TAlloc > | part,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const
| inline

C_VerifyUpdate continues a multiple-part verification operation, where the signature is an appendix to the data, and plaintext cannot be recovered from the signature.

Parameters

  session | the session's handle
  part | signed data
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized DataLenRange DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory OK OperationNotInitialized SessionClosed SessionHandleInvalid

Returns
  true on success, false otherwise

Definition at line 2479 of file p11.h.

2482 {
2483 return C_VerifyUpdate(session, part.data(), static_cast<Ulong>(part.size()), return_value);
2484 }
Botan::PKCS11::LowLevel::C_VerifyUpdate
bool C_VerifyUpdate(SessionHandle session, Byte *part_ptr, Ulong part_len, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:585

## ◆ C_WaitForSlotEvent()

bool Botan::PKCS11::LowLevel::C_WaitForSlotEvent | ( | Flags | flags,
|  | SlotId * | slot_ptr,
|  | VoidPtr | reserved,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_WaitForSlotEvent waits for a slot event (token insertion, removal, etc.) to occur.

Parameters

  flags | blocking/nonblocking flag
  slot_ptr | location that receives the slot ID
  reserved | reserved. Should be NULL_PTR
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad CryptokiNotInitialized FunctionFailed GeneralError HostMemory NoEvent OK

Returns
  true on success, false otherwise

Definition at line 158 of file p11.cpp.

162 {
163 return handle_return_value(m_func_list_ptr->C_WaitForSlotEvent(flags, slot_ptr, reserved), return_value);
164 }

References Botan::PKCS11::flags().

## ◆ C_WrapKey()

bool Botan::PKCS11::LowLevel::C_WrapKey | ( | SessionHandle | session,
|  | Mechanism * | mechanism_ptr,
|  | ObjectHandle | wrapping_key,
|  | ObjectHandle | key,
|  | Byte * | wrapped_key_ptr,
|  | Ulong * | wrapped_key_len_ptr,
|  | ReturnValue * | return_value = `ThrowException`
| ) |  | const

C_WrapKey wraps (i.e., encrypts) a key.

Parameters

  session | the session's handle
  mechanism_ptr | the wrapping mechanism
  wrapping_key | wrapping key
  key | key to be wrapped
  wrapped_key_ptr | gets wrapped key
  wrapped_key_len_ptr | gets wrapped key size
  return_value | default value (`ThrowException`): throw exception on error. if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. At least the following PKCS#11 return values may be returned: ArgumentsBad BufferTooSmall CryptokiNotInitialized DeviceError DeviceMemory DeviceRemoved FunctionCanceled FunctionFailed GeneralError HostMemory KeyHandleInvalid KeyNotWrappable KeySizeRange KeyUnextractable MechanismInvalid MechanismParamInvalid OK OperationActive PinExpired SessionClosed SessionHandleInvalid UserNotLoggedIn WrappingKeyHandleInvalid WrappingKeySizeRange WrappingKeyTypeInconsistent

Returns
  true on success, false otherwise

Definition at line 694 of file p11.cpp.

701 {
702 return handle_return_value(m_func_list_ptr->C_WrapKey(session, mechanism_ptr, wrapping_key, key, wrapped_key_ptr,
703 wrapped_key_len_ptr), return_value);
704 }

The documentation for this class was generated from the following files:

- src/lib/prov/pkcs11/p11.h
- src/lib/prov/pkcs11/p11.cpp