Pkcs11Interop  4.0.0
Public Member Functions | Protected Member Functions | Properties | List of all members
Net.Pkcs11Interop.LowLevelAPI40.Pkcs11 Class Reference

Low level PKCS#11 wrapper More...

Inherits IDisposable.

Public Member Functions

 Pkcs11 (string libraryPath)
 Loads PCKS#11 library More...
 
 Pkcs11 (string libraryPath, bool useGetFunctionList)
 Loads PCKS#11 library More...
 
CKR C_Initialize (CK_C_INITIALIZE_ARGS initArgs)
 Initializes the Cryptoki library More...
 
CKR C_Finalize (IntPtr reserved)
 Called to indicate that an application is finished with the Cryptoki library. It should be the last Cryptoki call made by an application. More...
 
CKR C_GetInfo (ref CK_INFO info)
 Returns general information about Cryptoki More...
 
CKR C_GetFunctionList (out IntPtr functionList)
 Returns a pointer to the Cryptoki library's list of function pointers More...
 
CKR C_GetSlotList (bool tokenPresent, uint[] slotList, ref uint count)
 Obtains a list of slots in the system More...
 
CKR C_GetSlotInfo (uint slotId, ref CK_SLOT_INFO info)
 Obtains information about a particular slot in the system More...
 
CKR C_GetTokenInfo (uint slotId, ref CK_TOKEN_INFO info)
 Obtains information about a particular token in the system More...
 
CKR C_GetMechanismList (uint slotId, CKM[] mechanismList, ref uint count)
 Obtains a list of mechanism types supported by a token More...
 
CKR C_GetMechanismInfo (uint slotId, CKM type, ref CK_MECHANISM_INFO info)
 Obtains information about a particular mechanism possibly supported by a token More...
 
CKR C_InitToken (uint slotId, byte[] pin, uint pinLen, byte[] label)
 Initializes a token More...
 
CKR C_InitPIN (uint session, byte[] pin, uint pinLen)
 Initializes the normal user's PIN More...
 
CKR C_SetPIN (uint session, byte[] oldPin, uint oldPinLen, byte[] newPin, uint newPinLen)
 Modifies the PIN of the user that is currently logged in, or the CKU_USER PIN if the session is not logged in More...
 
CKR C_OpenSession (uint slotId, uint flags, IntPtr application, IntPtr notify, ref uint session)
 Opens a session between an application and a token in a particular slot More...
 
CKR C_CloseSession (uint session)
 Closes a session between an application and a token More...
 
CKR C_CloseAllSessions (uint slotId)
 Closes all sessions an application has with a token More...
 
CKR C_GetSessionInfo (uint session, ref CK_SESSION_INFO info)
 Obtains information about a session More...
 
CKR C_GetOperationState (uint session, byte[] operationState, ref uint operationStateLen)
 Obtains a copy of the cryptographic operations state of a session encoded as byte array More...
 
CKR C_SetOperationState (uint session, byte[] operationState, uint operationStateLen, uint encryptionKey, uint authenticationKey)
 Restores the cryptographic operations state of a session from bytes obtained with C_GetOperationState More...
 
CKR C_Login (uint session, CKU userType, byte[] pin, uint pinLen)
 Logs a user into a token More...
 
CKR C_Logout (uint session)
 Logs a user out from a token More...
 
CKR C_CreateObject (uint session, CK_ATTRIBUTE[] template, uint count, ref uint objectId)
 Creates a new object More...
 
CKR C_CopyObject (uint session, uint objectId, CK_ATTRIBUTE[] template, uint count, ref uint newObjectId)
 Copies an object, creating a new object for the copy More...
 
CKR C_DestroyObject (uint session, uint objectId)
 Destroys an object More...
 
CKR C_GetObjectSize (uint session, uint objectId, ref uint size)
 Gets the size of an object in bytes More...
 
CKR C_GetAttributeValue (uint session, uint objectId, CK_ATTRIBUTE[] template, uint count)
 Obtains the value of one or more attributes of an object More...
 
CKR C_SetAttributeValue (uint session, uint objectId, CK_ATTRIBUTE[] template, uint count)
 Modifies the value of one or more attributes of an object More...
 
CKR C_FindObjectsInit (uint session, CK_ATTRIBUTE[] template, uint count)
 Initializes a search for token and session objects that match a template More...
 
CKR C_FindObjects (uint session, uint[] objectId, uint maxObjectCount, ref uint objectCount)
 Continues a search for token and session objects that match a template, obtaining additional object handles More...
 
CKR C_FindObjectsFinal (uint session)
 Terminates a search for token and session objects More...
 
CKR C_EncryptInit (uint session, ref CK_MECHANISM mechanism, uint key)
 Initializes an encryption operation More...
 
CKR C_Encrypt (uint session, byte[] data, uint dataLen, byte[] encryptedData, ref uint encryptedDataLen)
 Encrypts single-part data More...
 
CKR C_EncryptUpdate (uint session, byte[] part, uint partLen, byte[] encryptedPart, ref uint encryptedPartLen)
 Continues a multi-part encryption operation, processing another data part More...
 
CKR C_EncryptFinal (uint session, byte[] lastEncryptedPart, ref uint lastEncryptedPartLen)
 Finishes a multi-part encryption operation More...
 
CKR C_DecryptInit (uint session, ref CK_MECHANISM mechanism, uint key)
 Initializes a decryption operation More...
 
CKR C_Decrypt (uint session, byte[] encryptedData, uint encryptedDataLen, byte[] data, ref uint dataLen)
 Decrypts encrypted data in a single part More...
 
CKR C_DecryptUpdate (uint session, byte[] encryptedPart, uint encryptedPartLen, byte[] part, ref uint partLen)
 Continues a multi-part decryption operation, processing another encrypted data part More...
 
CKR C_DecryptFinal (uint session, byte[] lastPart, ref uint lastPartLen)
 Finishes a multi-part decryption operation More...
 
CKR C_DigestInit (uint session, ref CK_MECHANISM mechanism)
 Initializes a message-digesting operation More...
 
CKR C_Digest (uint session, byte[] data, uint dataLen, byte[] digest, ref uint digestLen)
 Digests data in a single part More...
 
CKR C_DigestUpdate (uint session, byte[] part, uint partLen)
 Continues a multi-part message-digesting operation, processing another data part More...
 
CKR C_DigestKey (uint session, uint key)
 Continues a multi-part message-digesting operation by digesting the value of a secret key More...
 
CKR C_DigestFinal (uint session, byte[] digest, ref uint digestLen)
 Finishes a multi-part message-digesting operation, returning the message digest More...
 
CKR C_SignInit (uint session, ref CK_MECHANISM mechanism, uint key)
 Initializes a signature operation, where the signature is an appendix to the data More...
 
CKR C_Sign (uint session, byte[] data, uint dataLen, byte[] signature, ref uint signatureLen)
 Signs data in a single part, where the signature is an appendix to the data More...
 
CKR C_SignUpdate (uint session, byte[] part, uint partLen)
 Continues a multi-part signature operation, processing another data part More...
 
CKR C_SignFinal (uint session, byte[] signature, ref uint signatureLen)
 Finishes a multi-part signature operation, returning the signature More...
 
CKR C_SignRecoverInit (uint session, ref CK_MECHANISM mechanism, uint key)
 Initializes a signature operation, where the data can be recovered from the signature More...
 
CKR C_SignRecover (uint session, byte[] data, uint dataLen, byte[] signature, ref uint signatureLen)
 Signs data in a single operation, where the data can be recovered from the signature More...
 
CKR C_VerifyInit (uint session, ref CK_MECHANISM mechanism, uint key)
 Initializes a verification operation, where the signature is an appendix to the data More...
 
CKR C_Verify (uint session, byte[] data, uint dataLen, byte[] signature, uint signatureLen)
 Verifies a signature in a single-part operation, where the signature is an appendix to the data More...
 
CKR C_VerifyUpdate (uint session, byte[] part, uint partLen)
 Continues a multi-part verification operation, processing another data part More...
 
CKR C_VerifyFinal (uint session, byte[] signature, uint signatureLen)
 Finishes a multi-part verification operation, checking the signature More...
 
CKR C_VerifyRecoverInit (uint session, ref CK_MECHANISM mechanism, uint key)
 Initializes a signature verification operation, where the data is recovered from the signature More...
 
CKR C_VerifyRecover (uint session, byte[] signature, uint signatureLen, byte[] data, ref uint dataLen)
 Verifies a signature in a single-part operation, where the data is recovered from the signature More...
 
CKR C_DigestEncryptUpdate (uint session, byte[] part, uint partLen, byte[] encryptedPart, ref uint encryptedPartLen)
 Continues multi-part digest and encryption operations, processing another data part More...
 
CKR C_DecryptDigestUpdate (uint session, byte[] encryptedPart, uint encryptedPartLen, byte[] part, ref uint partLen)
 Continues a multi-part combined decryption and digest operation, processing another data part More...
 
CKR C_SignEncryptUpdate (uint session, byte[] part, uint partLen, byte[] encryptedPart, ref uint encryptedPartLen)
 Continues a multi-part combined signature and encryption operation, processing another data part More...
 
CKR C_DecryptVerifyUpdate (uint session, byte[] encryptedPart, uint encryptedPartLen, byte[] part, ref uint partLen)
 Continues a multi-part combined decryption and verification operation, processing another data part More...
 
CKR C_GenerateKey (uint session, ref CK_MECHANISM mechanism, CK_ATTRIBUTE[] template, uint count, ref uint key)
 Generates a secret key or set of domain parameters, creating a new object More...
 
CKR C_GenerateKeyPair (uint session, ref CK_MECHANISM mechanism, CK_ATTRIBUTE[] publicKeyTemplate, uint publicKeyAttributeCount, CK_ATTRIBUTE[] privateKeyTemplate, uint privateKeyAttributeCount, ref uint publicKey, ref uint privateKey)
 Generates a public/private key pair, creating new key objects More...
 
CKR C_WrapKey (uint session, ref CK_MECHANISM mechanism, uint wrappingKey, uint key, byte[] wrappedKey, ref uint wrappedKeyLen)
 Wraps (i.e., encrypts) a private or secret key More...
 
CKR C_UnwrapKey (uint session, ref CK_MECHANISM mechanism, uint unwrappingKey, byte[] wrappedKey, uint wrappedKeyLen, CK_ATTRIBUTE[] template, uint attributeCount, ref uint key)
 Unwraps (i.e. decrypts) a wrapped key, creating a new private key or secret key object More...
 
CKR C_DeriveKey (uint session, ref CK_MECHANISM mechanism, uint baseKey, CK_ATTRIBUTE[] template, uint attributeCount, ref uint key)
 Derives a key from a base key, creating a new key object More...
 
CKR C_SeedRandom (uint session, byte[] seed, uint seedLen)
 Mixes additional seed material into the token's random number generator More...
 
CKR C_GenerateRandom (uint session, byte[] randomData, uint randomLen)
 Generates random or pseudo-random data More...
 
CKR C_GetFunctionStatus (uint session)
 Legacy function which should simply return the value CKR_FUNCTION_NOT_PARALLEL More...
 
CKR C_CancelFunction (uint session)
 Legacy function which should simply return the value CKR_FUNCTION_NOT_PARALLEL More...
 
CKR C_WaitForSlotEvent (uint flags, ref uint slot, IntPtr reserved)
 Waits for a slot event, such as token insertion or token removal, to occur More...
 
void Dispose ()
 Disposes object More...
 

Protected Member Functions

virtual void Dispose (bool disposing)
 Disposes object More...
 

Properties

bool Disposed [get]
 Flag indicating whether instance has been disposed More...
 
IntPtr LibraryHandle [get]
 Handle to the PKCS#11 library. Use with caution! More...
 

Detailed Description

Low level PKCS#11 wrapper

Constructor & Destructor Documentation

Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.Pkcs11 ( string  libraryPath)

Loads PCKS#11 library

Parameters
libraryPathLibrary name or path
Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.Pkcs11 ( string  libraryPath,
bool  useGetFunctionList 
)

Loads PCKS#11 library

Parameters
libraryPathLibrary name or path
useGetFunctionListFlag indicating whether cryptoki function pointers should be acquired via C_GetFunctionList (true) or via platform native function (false)

Member Function Documentation

CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_CancelFunction ( uint  session)

Legacy function which should simply return the value CKR_FUNCTION_NOT_PARALLEL

Parameters
sessionThe session's handle
Returns
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_FUNCTION_FAILED, CKR_FUNCTION_NOT_PARALLEL, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_CLOSED
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_CloseAllSessions ( uint  slotId)

Closes all sessions an application has with a token

Parameters
slotIdThe ID of the token's slot
Returns
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_SLOT_ID_INVALID, CKR_TOKEN_NOT_PRESENT
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_CloseSession ( uint  session)

Closes a session between an application and a token

Parameters
sessionThe session's handle
Returns
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_CopyObject ( uint  session,
uint  objectId,
CK_ATTRIBUTE[]  template,
uint  count,
ref uint  newObjectId 
)

Copies an object, creating a new object for the copy

Parameters
sessionThe session's handle
objectIdThe object's handle
templateTemplate for the new object
countThe number of attributes in the template
newObjectIdLocation that receives the handle for the copy of the object
Returns
CKR_ACTION_PROHIBITED, CKR_ARGUMENTS_BAD, CKR_ATTRIBUTE_READ_ONLY, CKR_ATTRIBUTE_TYPE_INVALID, CKR_ATTRIBUTE_VALUE_INVALID, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OBJECT_HANDLE_INVALID, CKR_OK, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_READ_ONLY, CKR_TEMPLATE_INCONSISTENT, CKR_TOKEN_WRITE_PROTECTED, CKR_USER_NOT_LOGGED_IN
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_CreateObject ( uint  session,
CK_ATTRIBUTE[]  template,
uint  count,
ref uint  objectId 
)

Creates a new object

Parameters
sessionThe session's handle
templateObject's template
countThe number of attributes in the template
objectIdLocation that receives the new object's handle
Returns
CKR_ARGUMENTS_BAD, CKR_ATTRIBUTE_READ_ONLY, CKR_ATTRIBUTE_TYPE_INVALID, CKR_ATTRIBUTE_VALUE_INVALID, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_CURVE_NOT_SUPPORTED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_DOMAIN_PARAMS_INVALID, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_READ_ONLY, CKR_TEMPLATE_INCOMPLETE, CKR_TEMPLATE_INCONSISTENT, CKR_TOKEN_WRITE_PROTECTED, CKR_USER_NOT_LOGGED_IN
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_Decrypt ( uint  session,
byte[]  encryptedData,
uint  encryptedDataLen,
byte[]  data,
ref uint  dataLen 
)

Decrypts encrypted data in a single part

Parameters
sessionThe session's handle
encryptedDataEncrypted data
encryptedDataLenThe length of the encrypted data
dataIf set to null then the length of decrypted data is returned in "dataLen" parameter, without actually returning decrypted data. If not set to null then "dataLen" parameter must contain the lenght of data array and decrypted data is returned in "data" parameter.
dataLenLocation that holds the length of the decrypted data
Returns
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_ENCRYPTED_DATA_INVALID, CKR_ENCRYPTED_DATA_LEN_RANGE, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_DecryptDigestUpdate ( uint  session,
byte[]  encryptedPart,
uint  encryptedPartLen,
byte[]  part,
ref uint  partLen 
)

Continues a multi-part combined decryption and digest operation, processing another data part

Parameters
sessionThe session's handle
encryptedPartEncrypted data part
encryptedPartLenLength of the encrypted data part
partIf set to null then the length of decrypted data part is returned in "partLen" parameter, without actually returning decrypted data part. If not set to null then "partLen" parameter must contain the lenght of part array and decrypted data part is returned in "part" parameter.
partLenLocation that holds the length of the decrypted data part
Returns
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_ENCRYPTED_DATA_INVALID, CKR_ENCRYPTED_DATA_LEN_RANGE, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_DecryptFinal ( uint  session,
byte[]  lastPart,
ref uint  lastPartLen 
)

Finishes a multi-part decryption operation

Parameters
sessionThe session's handle
lastPartIf set to null then the length of last decrypted data part is returned in "lastPartLen" parameter, without actually returning last decrypted data part. If not set to null then "lastPartLen" parameter must contain the lenght of lastPart array and last decrypted data part is returned in "lastPart" parameter.
lastPartLenLocation that holds the length of the last decrypted data part
Returns
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_ENCRYPTED_DATA_INVALID, CKR_ENCRYPTED_DATA_LEN_RANGE, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_DecryptInit ( uint  session,
ref CK_MECHANISM  mechanism,
uint  key 
)

Initializes a decryption operation

Parameters
sessionThe session's handle
mechanismThe decryption mechanism
keyThe handle of the decryption key
Returns
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_KEY_FUNCTION_NOT_PERMITTED, CKR_KEY_HANDLE_INVALID, CKR_KEY_SIZE_RANGE, CKR_KEY_TYPE_INCONSISTENT, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_DecryptUpdate ( uint  session,
byte[]  encryptedPart,
uint  encryptedPartLen,
byte[]  part,
ref uint  partLen 
)

Continues a multi-part decryption operation, processing another encrypted data part

Parameters
sessionThe session's handle
encryptedPartEncrypted data part
encryptedPartLenLength of the encrypted data part
partIf set to null then the length of decrypted data part is returned in "partLen" parameter, without actually returning decrypted data part. If not set to null then "partLen" parameter must contain the lenght of part array and decrypted data part is returned in "part" parameter.
partLenLocation that holds the length of the decrypted data part
Returns
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_ENCRYPTED_DATA_INVALID, CKR_ENCRYPTED_DATA_LEN_RANGE, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_DecryptVerifyUpdate ( uint  session,
byte[]  encryptedPart,
uint  encryptedPartLen,
byte[]  part,
ref uint  partLen 
)

Continues a multi-part combined decryption and verification operation, processing another data part

Parameters
sessionThe session's handle
encryptedPartEncrypted data part
encryptedPartLenLength of the encrypted data part
partIf set to null then the length of decrypted data part is returned in "partLen" parameter, without actually returning decrypted data part. If not set to null then "partLen" parameter must contain the lenght of part array and decrypted data part is returned in "part" parameter.
partLenLocation that holds the length of the decrypted data part
Returns
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_ENCRYPTED_DATA_INVALID, CKR_ENCRYPTED_DATA_LEN_RANGE, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_DeriveKey ( uint  session,
ref CK_MECHANISM  mechanism,
uint  baseKey,
CK_ATTRIBUTE[]  template,
uint  attributeCount,
ref uint  key 
)

Derives a key from a base key, creating a new key object

Parameters
sessionThe session's handle
mechanismKey derivation mechanism
baseKeyThe handle of the base key
templateThe template for the new key
attributeCountThe number of attributes in the template
keyLocation that receives the handle of the derived key
Returns
CKR_ARGUMENTS_BAD, CKR_ATTRIBUTE_READ_ONLY, CKR_ATTRIBUTE_TYPE_INVALID, CKR_ATTRIBUTE_VALUE_INVALID, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_CURVE_NOT_SUPPORTED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_DOMAIN_PARAMS_INVALID, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_KEY_HANDLE_INVALID, CKR_KEY_SIZE_RANGE, CKR_KEY_TYPE_INCONSISTENT, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_READ_ONLY, CKR_TEMPLATE_INCOMPLETE, CKR_TEMPLATE_INCONSISTENT, CKR_TOKEN_WRITE_PROTECTED, CKR_USER_NOT_LOGGED_IN
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_DestroyObject ( uint  session,
uint  objectId 
)

Destroys an object

Parameters
sessionThe session's handle
objectIdThe object's handle
Returns
CKR_ACTION_PROHIBITED, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OBJECT_HANDLE_INVALID, CKR_OK, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_READ_ONLY, CKR_TOKEN_WRITE_PROTECTED
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_Digest ( uint  session,
byte[]  data,
uint  dataLen,
byte[]  digest,
ref uint  digestLen 
)

Digests data in a single part

Parameters
sessionThe session's handle
dataData to be digested
dataLenThe length of the data to be digested
digestIf set to null then the length of digest is returned in "digestLen" parameter, without actually returning digest. If not set to null then "digestLen" parameter must contain the lenght of digest array and digest is returned in "digest" parameter.
digestLenLocation that holds the length of the message digest
Returns
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_DigestEncryptUpdate ( uint  session,
byte[]  part,
uint  partLen,
byte[]  encryptedPart,
ref uint  encryptedPartLen 
)

Continues multi-part digest and encryption operations, processing another data part

Parameters
sessionThe session's handle
partThe data part to be digested and encrypted
partLenLength of data part in bytes
encryptedPartIf set to null then the length of encrypted data part is returned in "encryptedPartLen" parameter, without actually returning encrypted data part. If not set to null then "encryptedPartLen" parameter must contain the lenght of encryptedPart array and encrypted data part is returned in "encryptedPart" parameter.
encryptedPartLenLocation that holds the length in bytes of the encrypted data part
Returns
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_DigestFinal ( uint  session,
byte[]  digest,
ref uint  digestLen 
)

Finishes a multi-part message-digesting operation, returning the message digest

Parameters
sessionThe session's handle
digestIf set to null then the length of digest is returned in "digestLen" parameter, without actually returning digest. If not set to null then "digestLen" parameter must contain the lenght of digest array and digest is returned in "digest" parameter.
digestLenLocation that holds the length of the message digest
Returns
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_DigestInit ( uint  session,
ref CK_MECHANISM  mechanism 
)

Initializes a message-digesting operation

Parameters
sessionThe session's handle
mechanismThe digesting mechanism
Returns
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_DigestKey ( uint  session,
uint  key 
)

Continues a multi-part message-digesting operation by digesting the value of a secret key

Parameters
sessionThe session's handle
keyThe handle of the secret key to be digested
Returns
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_KEY_HANDLE_INVALID, CKR_KEY_INDIGESTIBLE, CKR_KEY_SIZE_RANGE, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_DigestUpdate ( uint  session,
byte[]  part,
uint  partLen 
)

Continues a multi-part message-digesting operation, processing another data part

Parameters
sessionThe session's handle
partData part
partLenThe length of the data part
Returns
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_Encrypt ( uint  session,
byte[]  data,
uint  dataLen,
byte[]  encryptedData,
ref uint  encryptedDataLen 
)

Encrypts single-part data

Parameters
sessionThe session's handle
dataData to be encrypted
dataLenLength of data in bytes
encryptedDataIf set to null then the length of encrypted data is returned in "encryptedDataLen" parameter, without actually returning encrypted data. If not set to null then "encryptedDataLen" parameter must contain the lenght of encryptedData array and encrypted data is returned in "encryptedData" parameter.
encryptedDataLenLocation that holds the length in bytes of the encrypted data
Returns
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_INVALID, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_EncryptFinal ( uint  session,
byte[]  lastEncryptedPart,
ref uint  lastEncryptedPartLen 
)

Finishes a multi-part encryption operation

Parameters
sessionThe session's handle
lastEncryptedPartIf set to null then the length of last encrypted data part is returned in "lastEncryptedPartLen" parameter, without actually returning last encrypted data part. If not set to null then "lastEncryptedPartLen" parameter must contain the lenght of lastEncryptedPart array and last encrypted data part is returned in "lastEncryptedPart" parameter.
lastEncryptedPartLenLocation that holds the length of the last encrypted data part
Returns
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_EncryptInit ( uint  session,
ref CK_MECHANISM  mechanism,
uint  key 
)

Initializes an encryption operation

Parameters
sessionThe session's handle
mechanismThe encryption mechanism
keyThe handle of the encryption key
Returns
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_KEY_FUNCTION_NOT_PERMITTED, CKR_KEY_HANDLE_INVALID, CKR_KEY_SIZE_RANGE, CKR_KEY_TYPE_INCONSISTENT, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_EncryptUpdate ( uint  session,
byte[]  part,
uint  partLen,
byte[]  encryptedPart,
ref uint  encryptedPartLen 
)

Continues a multi-part encryption operation, processing another data part

Parameters
sessionThe session's handle
partThe data part to be encrypted
partLenLength of data part in bytes
encryptedPartIf set to null then the length of encrypted data part is returned in "encryptedPartLen" parameter, without actually returning encrypted data part. If not set to null then "encryptedPartLen" parameter must contain the lenght of encryptedPart array and encrypted data part is returned in "encryptedPart" parameter.
encryptedPartLenLocation that holds the length in bytes of the encrypted data part
Returns
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_Finalize ( IntPtr  reserved)

Called to indicate that an application is finished with the Cryptoki library. It should be the last Cryptoki call made by an application.

Parameters
reservedReserved for future versions. For this version, it should be set to null.
Returns
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_FindObjects ( uint  session,
uint[]  objectId,
uint  maxObjectCount,
ref uint  objectCount 
)

Continues a search for token and session objects that match a template, obtaining additional object handles

Parameters
sessionThe session's handle
objectIdLocation that receives the list (array) of additional object handles
maxObjectCountThe maximum number of object handles to be returned
objectCountLocation that receives the actual number of object handles returned
Returns
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_FindObjectsFinal ( uint  session)

Terminates a search for token and session objects

Parameters
sessionThe session's handle
Returns
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_FindObjectsInit ( uint  session,
CK_ATTRIBUTE[]  template,
uint  count 
)

Initializes a search for token and session objects that match a template

Parameters
sessionThe session's handle
templateSearch template that specifies the attribute values to match
countThe number of attributes in the search template
Returns
CKR_ARGUMENTS_BAD, CKR_ATTRIBUTE_TYPE_INVALID, CKR_ATTRIBUTE_VALUE_INVALID, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_GenerateKey ( uint  session,
ref CK_MECHANISM  mechanism,
CK_ATTRIBUTE[]  template,
uint  count,
ref uint  key 
)

Generates a secret key or set of domain parameters, creating a new object

Parameters
sessionThe session's handle
mechanismKey generation mechanism
templateThe template for the new key or set of domain parameters
countThe number of attributes in the template
keyLocation that receives the handle of the new key or set of domain parameters
Returns
CKR_ARGUMENTS_BAD, CKR_ATTRIBUTE_READ_ONLY, CKR_ATTRIBUTE_TYPE_INVALID, CKR_ATTRIBUTE_VALUE_INVALID, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_CURVE_NOT_SUPPORTED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_READ_ONLY, CKR_TEMPLATE_INCOMPLETE, CKR_TEMPLATE_INCONSISTENT, CKR_TOKEN_WRITE_PROTECTED, CKR_USER_NOT_LOGGED_IN
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_GenerateKeyPair ( uint  session,
ref CK_MECHANISM  mechanism,
CK_ATTRIBUTE[]  publicKeyTemplate,
uint  publicKeyAttributeCount,
CK_ATTRIBUTE[]  privateKeyTemplate,
uint  privateKeyAttributeCount,
ref uint  publicKey,
ref uint  privateKey 
)

Generates a public/private key pair, creating new key objects

Parameters
sessionThe session's handle
mechanismKey generation mechanism
publicKeyTemplateThe template for the public key
publicKeyAttributeCountThe number of attributes in the public-key template
privateKeyTemplateThe template for the private key
privateKeyAttributeCountThe number of attributes in the private-key template
publicKeyLocation that receives the handle of the new public key
privateKeyLocation that receives the handle of the new private key
Returns
CKR_ARGUMENTS_BAD, CKR_ATTRIBUTE_READ_ONLY, CKR_ATTRIBUTE_TYPE_INVALID, CKR_ATTRIBUTE_VALUE_INVALID, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_CURVE_NOT_SUPPORTED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_DOMAIN_PARAMS_INVALID, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_READ_ONLY, CKR_TEMPLATE_INCOMPLETE, CKR_TEMPLATE_INCONSISTENT, CKR_TOKEN_WRITE_PROTECTED, CKR_USER_NOT_LOGGED_IN
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_GenerateRandom ( uint  session,
byte[]  randomData,
uint  randomLen 
)

Generates random or pseudo-random data

Parameters
sessionThe session's handle
randomDataLocation that receives the random data
randomLenThe length in bytes of the random or pseudo-random data to be generated
Returns
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_ACTIVE, CKR_RANDOM_NO_RNG, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_GetAttributeValue ( uint  session,
uint  objectId,
CK_ATTRIBUTE[]  template,
uint  count 
)

Obtains the value of one or more attributes of an object

Parameters
sessionThe session's handle
objectIdThe object's handle
templateTemplate that specifies which attribute values are to be obtained, and receives the attribute values
countThe number of attributes in the template
Returns
CKR_ARGUMENTS_BAD, CKR_ATTRIBUTE_SENSITIVE, CKR_ATTRIBUTE_TYPE_INVALID, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OBJECT_HANDLE_INVALID, CKR_OK, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_GetFunctionList ( out IntPtr  functionList)

Returns a pointer to the Cryptoki library's list of function pointers

Parameters
functionListPointer to a value which will receive a pointer to the library's CK_FUNCTION_LIST structure
Returns
CKR_ARGUMENTS_BAD, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_GetFunctionStatus ( uint  session)

Legacy function which should simply return the value CKR_FUNCTION_NOT_PARALLEL

Parameters
sessionThe session's handle
Returns
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_FUNCTION_FAILED, CKR_FUNCTION_NOT_PARALLEL, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_CLOSED
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_GetInfo ( ref CK_INFO  info)

Returns general information about Cryptoki

Parameters
infoStructure that receives the information
Returns
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_GetMechanismInfo ( uint  slotId,
CKM  type,
ref CK_MECHANISM_INFO  info 
)

Obtains information about a particular mechanism possibly supported by a token

Parameters
slotIdThe ID of the token's slot
typeThe type of mechanism
infoStructure that receives the mechanism information
Returns
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_MECHANISM_INVALID, CKR_OK, CKR_SLOT_ID_INVALID, CKR_TOKEN_NOT_PRESENT, CKR_TOKEN_NOT_RECOGNIZED, CKR_ARGUMENTS_BAD
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_GetMechanismList ( uint  slotId,
CKM[]  mechanismList,
ref uint  count 
)

Obtains a list of mechanism types supported by a token

Parameters
slotIdThe ID of the token's slot
mechanismListIf set to null then the number of mechanisms is returned in "count" parameter, without actually returning a list of mechanisms. If not set to null then "count" parameter must contain the lenght of mechanismList array and mechanism list is returned in "mechanismList" parameter.
countLocation that receives the number of mechanisms
Returns
CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_SLOT_ID_INVALID, CKR_TOKEN_NOT_PRESENT, CKR_TOKEN_NOT_RECOGNIZED, CKR_ARGUMENTS_BAD
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_GetObjectSize ( uint  session,
uint  objectId,
ref uint  size 
)

Gets the size of an object in bytes

Parameters
sessionThe session's handle
objectIdThe object's handle
sizeLocation that receives the size in bytes of the object
Returns
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_INFORMATION_SENSITIVE, CKR_OBJECT_HANDLE_INVALID, CKR_OK, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_GetOperationState ( uint  session,
byte[]  operationState,
ref uint  operationStateLen 
)

Obtains a copy of the cryptographic operations state of a session encoded as byte array

Parameters
sessionThe session's handle
operationStateIf set to null then the length of state is returned in "operationStateLen" parameter, without actually returning a state. If not set to null then "operationStateLen" parameter must contain the lenght of operationState array and state is returned in "operationState" parameter.
operationStateLenLocation that receives the length in bytes of the state
Returns
CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_STATE_UNSAVEABLE, CKR_ARGUMENTS_BAD
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_GetSessionInfo ( uint  session,
ref CK_SESSION_INFO  info 
)

Obtains information about a session

Parameters
sessionThe session's handle
infoStructure that receives the session information
Returns
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_ARGUMENTS_BAD
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_GetSlotInfo ( uint  slotId,
ref CK_SLOT_INFO  info 
)

Obtains information about a particular slot in the system

Parameters
slotIdThe ID of the slot
infoStructure that receives the slot information
Returns
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_SLOT_ID_INVALID
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_GetSlotList ( bool  tokenPresent,
uint[]  slotList,
ref uint  count 
)

Obtains a list of slots in the system

Parameters
tokenPresentIndicates whether the list obtained includes only those slots with a token present (true) or all slots (false)
slotListIf set to null then the number of slots is returned in "count" parameter, without actually returning a list of slots. If not set to null then "count" parameter must contain the lenght of slotList array and slot list is returned in "slotList" parameter.
countLocation that receives the number of slots
Returns
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_GetTokenInfo ( uint  slotId,
ref CK_TOKEN_INFO  info 
)

Obtains information about a particular token in the system

Parameters
slotIdThe ID of the token's slot
infoStructure that receives the token information
Returns
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_SLOT_ID_INVALID, CKR_TOKEN_NOT_PRESENT, CKR_TOKEN_NOT_RECOGNIZED, CKR_ARGUMENTS_BAD
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_Initialize ( CK_C_INITIALIZE_ARGS  initArgs)

Initializes the Cryptoki library

Parameters
initArgsCK_C_INITIALIZE_ARGS structure containing information on how the library should deal with multi-threaded access or null if an application will not be accessing Cryptoki through multiple threads simultaneously
Returns
CKR_ARGUMENTS_BAD, CKR_CANT_LOCK, CKR_CRYPTOKI_ALREADY_INITIALIZED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_NEED_TO_CREATE_THREADS, CKR_OK
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_InitPIN ( uint  session,
byte[]  pin,
uint  pinLen 
)

Initializes the normal user's PIN

Parameters
sessionThe session's handle
pinNormal user's PIN or null to use protected authentication path (pinpad)
pinLenThe length of the PIN in bytes
Returns
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_PIN_INVALID, CKR_PIN_LEN_RANGE, CKR_SESSION_CLOSED, CKR_SESSION_READ_ONLY, CKR_SESSION_HANDLE_INVALID, CKR_TOKEN_WRITE_PROTECTED, CKR_USER_NOT_LOGGED_IN, CKR_ARGUMENTS_BAD
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_InitToken ( uint  slotId,
byte[]  pin,
uint  pinLen,
byte[]  label 
)

Initializes a token

Parameters
slotIdThe ID of the token's slot
pinSO's initial PIN or null to use protected authentication path (pinpad)
pinLenThe length of the PIN in bytes
label32-byte long label of the token which must be padded with blank characters
Returns
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_PIN_INCORRECT, CKR_PIN_LOCKED, CKR_SESSION_EXISTS, CKR_SLOT_ID_INVALID, CKR_TOKEN_NOT_PRESENT, CKR_TOKEN_NOT_RECOGNIZED, CKR_TOKEN_WRITE_PROTECTED, CKR_ARGUMENTS_BAD
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_Login ( uint  session,
CKU  userType,
byte[]  pin,
uint  pinLen 
)

Logs a user into a token

Parameters
sessionThe session's handle
userTypeThe user type
pinUser's PIN or null to use protected authentication path (pinpad)
pinLenLength of user's PIN
Returns
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_PIN_INCORRECT, CKR_PIN_LOCKED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_READ_ONLY_EXISTS, CKR_USER_ALREADY_LOGGED_IN, CKR_USER_ANOTHER_ALREADY_LOGGED_IN, CKR_USER_PIN_NOT_INITIALIZED, CKR_USER_TOO_MANY_TYPES, CKR_USER_TYPE_INVALID
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_Logout ( uint  session)

Logs a user out from a token

Parameters
sessionThe session's handle
Returns
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_OpenSession ( uint  slotId,
uint  flags,
IntPtr  application,
IntPtr  notify,
ref uint  session 
)

Opens a session between an application and a token in a particular slot

Parameters
slotIdThe ID of the token's slot
flagsFlags indicating the type of session
applicationAn application defined pointer to be passed to the notification callback
notifyThe address of the notification callback function
sessionLocation that receives the handle for the new session
Returns
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_SESSION_COUNT, CKR_SESSION_PARALLEL_NOT_SUPPORTED, CKR_SESSION_READ_WRITE_SO_EXISTS, CKR_SLOT_ID_INVALID, CKR_TOKEN_NOT_PRESENT, CKR_TOKEN_NOT_RECOGNIZED, CKR_TOKEN_WRITE_PROTECTED, CKR_ARGUMENTS_BAD
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_SeedRandom ( uint  session,
byte[]  seed,
uint  seedLen 
)

Mixes additional seed material into the token's random number generator

Parameters
sessionThe session's handle
seedThe seed material
seedLenThe length of the seed material
Returns
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_ACTIVE, CKR_RANDOM_SEED_NOT_SUPPORTED, CKR_RANDOM_NO_RNG, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_SetAttributeValue ( uint  session,
uint  objectId,
CK_ATTRIBUTE[]  template,
uint  count 
)

Modifies the value of one or more attributes of an object

Parameters
sessionThe session's handle
objectIdThe object's handle
templateTemplate that specifies which attribute values are to be modified and their new values
countThe number of attributes in the template
Returns
CKR_ACTION_PROHIBITED, CKR_ARGUMENTS_BAD, CKR_ATTRIBUTE_READ_ONLY, CKR_ATTRIBUTE_TYPE_INVALID, CKR_ATTRIBUTE_VALUE_INVALID, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OBJECT_HANDLE_INVALID, CKR_OK, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_READ_ONLY, CKR_TEMPLATE_INCONSISTENT, CKR_TOKEN_WRITE_PROTECTED, CKR_USER_NOT_LOGGED_IN
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_SetOperationState ( uint  session,
byte[]  operationState,
uint  operationStateLen,
uint  encryptionKey,
uint  authenticationKey 
)

Restores the cryptographic operations state of a session from bytes obtained with C_GetOperationState

Parameters
sessionThe session's handle
operationStateSaved session state
operationStateLenLength of saved session state
encryptionKeyHandle to the key which will be used for an ongoing encryption or decryption operation in the restored session or CK_INVALID_HANDLE if not needed
authenticationKeyHandle to the key which will be used for an ongoing operation in the restored session or CK_INVALID_HANDLE if not needed
Returns
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_KEY_CHANGED, CKR_KEY_NEEDED, CKR_KEY_NOT_NEEDED, CKR_OK, CKR_SAVED_STATE_INVALID, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_ARGUMENTS_BAD
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_SetPIN ( uint  session,
byte[]  oldPin,
uint  oldPinLen,
byte[]  newPin,
uint  newPinLen 
)

Modifies the PIN of the user that is currently logged in, or the CKU_USER PIN if the session is not logged in

Parameters
sessionThe session's handle
oldPinOld PIN or null to use protected authentication path (pinpad)
oldPinLenThe length of the old PIN in bytes
newPinNew PIN or null to use protected authentication path (pinpad)
newPinLenThe length of the new PIN in bytes
Returns
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_PIN_INCORRECT, CKR_PIN_INVALID, CKR_PIN_LEN_RANGE, CKR_PIN_LOCKED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_READ_ONLY, CKR_TOKEN_WRITE_PROTECTED, CKR_ARGUMENTS_BAD
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_Sign ( uint  session,
byte[]  data,
uint  dataLen,
byte[]  signature,
ref uint  signatureLen 
)

Signs data in a single part, where the signature is an appendix to the data

Parameters
sessionThe session's handle
dataData to be signed
dataLenThe length of the data
signatureIf set to null then the length of signature is returned in "signatureLen" parameter, without actually returning signature. If not set to null then "signatureLen" parameter must contain the lenght of signature array and signature is returned in "signature" parameter.
signatureLenLocation that holds the length of the signature
Returns
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_INVALID, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN, CKR_FUNCTION_REJECTED
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_SignEncryptUpdate ( uint  session,
byte[]  part,
uint  partLen,
byte[]  encryptedPart,
ref uint  encryptedPartLen 
)

Continues a multi-part combined signature and encryption operation, processing another data part

Parameters
sessionThe session's handle
partThe data part to be signed and encrypted
partLenLength of data part in bytes
encryptedPartIf set to null then the length of encrypted data part is returned in "encryptedPartLen" parameter, without actually returning encrypted data part. If not set to null then "encryptedPartLen" parameter must contain the lenght of encryptedPart array and encrypted data part is returned in "encryptedPart" parameter.
encryptedPartLenLocation that holds the length in bytes of the encrypted data part
Returns
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_SignFinal ( uint  session,
byte[]  signature,
ref uint  signatureLen 
)

Finishes a multi-part signature operation, returning the signature

Parameters
sessionThe session's handle
signatureIf set to null then the length of signature is returned in "signatureLen" parameter, without actually returning signature. If not set to null then "signatureLen" parameter must contain the lenght of signature array and signature is returned in "signature" parameter.
signatureLenLocation that holds the length of the signature
Returns
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN, CKR_FUNCTION_REJECTED
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_SignInit ( uint  session,
ref CK_MECHANISM  mechanism,
uint  key 
)

Initializes a signature operation, where the signature is an appendix to the data

Parameters
sessionThe session's handle
mechanismSignature mechanism
keyHandle of the signature key
Returns
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_KEY_FUNCTION_NOT_PERMITTED,CKR_KEY_HANDLE_INVALID, CKR_KEY_SIZE_RANGE, CKR_KEY_TYPE_INCONSISTENT, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_SignRecover ( uint  session,
byte[]  data,
uint  dataLen,
byte[]  signature,
ref uint  signatureLen 
)

Signs data in a single operation, where the data can be recovered from the signature

Parameters
sessionThe session's handle
dataData to be signed
dataLenThe length of data to be signed
signatureIf set to null then the length of signature is returned in "signatureLen" parameter, without actually returning signature. If not set to null then "signatureLen" parameter must contain the lenght of signature array and signature is returned in "signature" parameter.
signatureLenLocation that holds the length of the signature
Returns
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_INVALID, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_SignRecoverInit ( uint  session,
ref CK_MECHANISM  mechanism,
uint  key 
)

Initializes a signature operation, where the data can be recovered from the signature

Parameters
sessionThe session's handle
mechanismSignature mechanism
keyHandle of the signature key
Returns
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_KEY_FUNCTION_NOT_PERMITTED, CKR_KEY_HANDLE_INVALID, CKR_KEY_SIZE_RANGE, CKR_KEY_TYPE_INCONSISTENT, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_SignUpdate ( uint  session,
byte[]  part,
uint  partLen 
)

Continues a multi-part signature operation, processing another data part

Parameters
sessionThe session's handle
partData part
partLenThe length of the data part
Returns
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_UnwrapKey ( uint  session,
ref CK_MECHANISM  mechanism,
uint  unwrappingKey,
byte[]  wrappedKey,
uint  wrappedKeyLen,
CK_ATTRIBUTE[]  template,
uint  attributeCount,
ref uint  key 
)

Unwraps (i.e. decrypts) a wrapped key, creating a new private key or secret key object

Parameters
sessionThe session's handle
mechanismUnwrapping mechanism
unwrappingKeyThe handle of the unwrapping key
wrappedKeyWrapped key
wrappedKeyLenThe length of the wrapped key
templateThe template for the new key
attributeCountThe number of attributes in the template
keyLocation that receives the handle of the unwrapped key
Returns
CKR_ARGUMENTS_BAD, CKR_ATTRIBUTE_READ_ONLY, CKR_ATTRIBUTE_TYPE_INVALID, CKR_ATTRIBUTE_VALUE_INVALID, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_CURVE_NOT_SUPPORTED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_DOMAIN_PARAMS_INVALID, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_READ_ONLY, CKR_TEMPLATE_INCOMPLETE, CKR_TEMPLATE_INCONSISTENT, CKR_TOKEN_WRITE_PROTECTED, CKR_UNWRAPPING_KEY_HANDLE_INVALID, CKR_UNWRAPPING_KEY_SIZE_RANGE, CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT, CKR_USER_NOT_LOGGED_IN, CKR_WRAPPED_KEY_INVALID, CKR_WRAPPED_KEY_LEN_RANGE
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_Verify ( uint  session,
byte[]  data,
uint  dataLen,
byte[]  signature,
uint  signatureLen 
)

Verifies a signature in a single-part operation, where the signature is an appendix to the data

Parameters
sessionThe session's handle
dataData that were signed
dataLenThe length of the data
signatureSignature of data
signatureLenThe length of signature
Returns
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_INVALID, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SIGNATURE_INVALID, CKR_SIGNATURE_LEN_RANGE
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_VerifyFinal ( uint  session,
byte[]  signature,
uint  signatureLen 
)

Finishes a multi-part verification operation, checking the signature

Parameters
sessionThe session's handle
signatureSignature
signatureLenThe length of signature
Returns
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SIGNATURE_INVALID, CKR_SIGNATURE_LEN_RANGE
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_VerifyInit ( uint  session,
ref CK_MECHANISM  mechanism,
uint  key 
)

Initializes a verification operation, where the signature is an appendix to the data

Parameters
sessionThe session's handle
mechanismThe verification mechanism
keyThe handle of the verification key
Returns
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_KEY_FUNCTION_NOT_PERMITTED, CKR_KEY_HANDLE_INVALID, CKR_KEY_SIZE_RANGE, CKR_KEY_TYPE_INCONSISTENT, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_VerifyRecover ( uint  session,
byte[]  signature,
uint  signatureLen,
byte[]  data,
ref uint  dataLen 
)

Verifies a signature in a single-part operation, where the data is recovered from the signature

Parameters
sessionThe session's handle
signatureSignature
signatureLenThe length of signature
dataIf set to null then the length of recovered data is returned in "dataLen" parameter, without actually returning recovered data. If not set to null then "dataLen" parameter must contain the lenght of data array and recovered data is returned in "data" parameter.
dataLenLocation that holds the length of the decrypted data
Returns
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_INVALID, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SIGNATURE_LEN_RANGE, CKR_SIGNATURE_INVALID
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_VerifyRecoverInit ( uint  session,
ref CK_MECHANISM  mechanism,
uint  key 
)

Initializes a signature verification operation, where the data is recovered from the signature

Parameters
sessionThe session's handle
mechanismVerification mechanism
keyThe handle of the verification key
Returns
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_KEY_FUNCTION_NOT_PERMITTED, CKR_KEY_HANDLE_INVALID, CKR_KEY_SIZE_RANGE, CKR_KEY_TYPE_INCONSISTENT, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_VerifyUpdate ( uint  session,
byte[]  part,
uint  partLen 
)

Continues a multi-part verification operation, processing another data part

Parameters
sessionThe session's handle
partData part
partLenThe length of the data part
Returns
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_WaitForSlotEvent ( uint  flags,
ref uint  slot,
IntPtr  reserved 
)

Waits for a slot event, such as token insertion or token removal, to occur

Parameters
flagsDetermines whether or not the C_WaitForSlotEvent call blocks (i.e., waits for a slot event to occur)
slotLocation which will receive the ID of the slot that the event occurred in
reservedReserved for future versions (should be null)
Returns
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_NO_EVENT, CKR_OK
CKR Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.C_WrapKey ( uint  session,
ref CK_MECHANISM  mechanism,
uint  wrappingKey,
uint  key,
byte[]  wrappedKey,
ref uint  wrappedKeyLen 
)

Wraps (i.e., encrypts) a private or secret key

Parameters
sessionThe session's handle
mechanismWrapping mechanism
wrappingKeyThe handle of the wrapping key
keyThe handle of the key to be wrapped
wrappedKeyIf set to null then the length of wrapped key is returned in "wrappedKeyLen" parameter, without actually returning wrapped key. If not set to null then "wrappedKeyLen" parameter must contain the lenght of wrappedKey array and wrapped key is returned in "wrappedKey" parameter.
wrappedKeyLenLocation that receives the length of the wrapped key
Returns
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_KEY_HANDLE_INVALID, CKR_KEY_NOT_WRAPPABLE, CKR_KEY_SIZE_RANGE, CKR_KEY_UNEXTRACTABLE, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN, CKR_WRAPPING_KEY_HANDLE_INVALID, CKR_WRAPPING_KEY_SIZE_RANGE, CKR_WRAPPING_KEY_TYPE_INCONSISTENT
void Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.Dispose ( )

Disposes object

virtual void Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.Dispose ( bool  disposing)
protectedvirtual

Disposes object

Parameters
disposingFlag indicating whether managed resources should be disposed

Property Documentation

bool Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.Disposed
get

Flag indicating whether instance has been disposed

IntPtr Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.LibraryHandle
get

Handle to the PKCS#11 library. Use with caution!


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