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

Loads PCKS#11 library

Parameters
libraryPathLibrary name or path
Net.Pkcs11Interop.LowLevelAPI81.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.LowLevelAPI81.Pkcs11.C_CancelFunction ( ulong  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.LowLevelAPI81.Pkcs11.C_CloseAllSessions ( ulong  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.LowLevelAPI81.Pkcs11.C_CloseSession ( ulong  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.LowLevelAPI81.Pkcs11.C_CopyObject ( ulong  session,
ulong  objectId,
CK_ATTRIBUTE[]  template,
ulong  count,
ref ulong  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.LowLevelAPI81.Pkcs11.C_CreateObject ( ulong  session,
CK_ATTRIBUTE[]  template,
ulong  count,
ref ulong  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.LowLevelAPI81.Pkcs11.C_Decrypt ( ulong  session,
byte[]  encryptedData,
ulong  encryptedDataLen,
byte[]  data,
ref ulong  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.LowLevelAPI81.Pkcs11.C_DecryptDigestUpdate ( ulong  session,
byte[]  encryptedPart,
ulong  encryptedPartLen,
byte[]  part,
ref ulong  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.LowLevelAPI81.Pkcs11.C_DecryptFinal ( ulong  session,
byte[]  lastPart,
ref ulong  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.LowLevelAPI81.Pkcs11.C_DecryptInit ( ulong  session,
ref CK_MECHANISM  mechanism,
ulong  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.LowLevelAPI81.Pkcs11.C_DecryptUpdate ( ulong  session,
byte[]  encryptedPart,
ulong  encryptedPartLen,
byte[]  part,
ref ulong  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.LowLevelAPI81.Pkcs11.C_DecryptVerifyUpdate ( ulong  session,
byte[]  encryptedPart,
ulong  encryptedPartLen,
byte[]  part,
ref ulong  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.LowLevelAPI81.Pkcs11.C_DeriveKey ( ulong  session,
ref CK_MECHANISM  mechanism,
ulong  baseKey,
CK_ATTRIBUTE[]  template,
ulong  attributeCount,
ref ulong  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.LowLevelAPI81.Pkcs11.C_DestroyObject ( ulong  session,
ulong  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.LowLevelAPI81.Pkcs11.C_Digest ( ulong  session,
byte[]  data,
ulong  dataLen,
byte[]  digest,
ref ulong  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.LowLevelAPI81.Pkcs11.C_DigestEncryptUpdate ( ulong  session,
byte[]  part,
ulong  partLen,
byte[]  encryptedPart,
ref ulong  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.LowLevelAPI81.Pkcs11.C_DigestFinal ( ulong  session,
byte[]  digest,
ref ulong  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.LowLevelAPI81.Pkcs11.C_DigestInit ( ulong  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.LowLevelAPI81.Pkcs11.C_DigestKey ( ulong  session,
ulong  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.LowLevelAPI81.Pkcs11.C_DigestUpdate ( ulong  session,
byte[]  part,
ulong  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.LowLevelAPI81.Pkcs11.C_Encrypt ( ulong  session,
byte[]  data,
ulong  dataLen,
byte[]  encryptedData,
ref ulong  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.LowLevelAPI81.Pkcs11.C_EncryptFinal ( ulong  session,
byte[]  lastEncryptedPart,
ref ulong  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.LowLevelAPI81.Pkcs11.C_EncryptInit ( ulong  session,
ref CK_MECHANISM  mechanism,
ulong  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.LowLevelAPI81.Pkcs11.C_EncryptUpdate ( ulong  session,
byte[]  part,
ulong  partLen,
byte[]  encryptedPart,
ref ulong  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.LowLevelAPI81.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.LowLevelAPI81.Pkcs11.C_FindObjects ( ulong  session,
ulong[]  objectId,
ulong  maxObjectCount,
ref ulong  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.LowLevelAPI81.Pkcs11.C_FindObjectsFinal ( ulong  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.LowLevelAPI81.Pkcs11.C_FindObjectsInit ( ulong  session,
CK_ATTRIBUTE[]  template,
ulong  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.LowLevelAPI81.Pkcs11.C_GenerateKey ( ulong  session,
ref CK_MECHANISM  mechanism,
CK_ATTRIBUTE[]  template,
ulong  count,
ref ulong  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.LowLevelAPI81.Pkcs11.C_GenerateKeyPair ( ulong  session,
ref CK_MECHANISM  mechanism,
CK_ATTRIBUTE[]  publicKeyTemplate,
ulong  publicKeyAttributeCount,
CK_ATTRIBUTE[]  privateKeyTemplate,
ulong  privateKeyAttributeCount,
ref ulong  publicKey,
ref ulong  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.LowLevelAPI81.Pkcs11.C_GenerateRandom ( ulong  session,
byte[]  randomData,
ulong  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.LowLevelAPI81.Pkcs11.C_GetAttributeValue ( ulong  session,
ulong  objectId,
CK_ATTRIBUTE[]  template,
ulong  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.LowLevelAPI81.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.LowLevelAPI81.Pkcs11.C_GetFunctionStatus ( ulong  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.LowLevelAPI81.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.LowLevelAPI81.Pkcs11.C_GetMechanismInfo ( ulong  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.LowLevelAPI81.Pkcs11.C_GetMechanismList ( ulong  slotId,
CKM[]  mechanismList,
ref ulong  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.LowLevelAPI81.Pkcs11.C_GetObjectSize ( ulong  session,
ulong  objectId,
ref ulong  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.LowLevelAPI81.Pkcs11.C_GetOperationState ( ulong  session,
byte[]  operationState,
ref ulong  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.LowLevelAPI81.Pkcs11.C_GetSessionInfo ( ulong  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.LowLevelAPI81.Pkcs11.C_GetSlotInfo ( ulong  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.LowLevelAPI81.Pkcs11.C_GetSlotList ( bool  tokenPresent,
ulong[]  slotList,
ref ulong  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.LowLevelAPI81.Pkcs11.C_GetTokenInfo ( ulong  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.LowLevelAPI81.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.LowLevelAPI81.Pkcs11.C_InitPIN ( ulong  session,
byte[]  pin,
ulong  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.LowLevelAPI81.Pkcs11.C_InitToken ( ulong  slotId,
byte[]  pin,
ulong  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.LowLevelAPI81.Pkcs11.C_Login ( ulong  session,
CKU  userType,
byte[]  pin,
ulong  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.LowLevelAPI81.Pkcs11.C_Logout ( ulong  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.LowLevelAPI81.Pkcs11.C_OpenSession ( ulong  slotId,
ulong  flags,
IntPtr  application,
IntPtr  notify,
ref ulong  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.LowLevelAPI81.Pkcs11.C_SeedRandom ( ulong  session,
byte[]  seed,
ulong  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.LowLevelAPI81.Pkcs11.C_SetAttributeValue ( ulong  session,
ulong  objectId,
CK_ATTRIBUTE[]  template,
ulong  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.LowLevelAPI81.Pkcs11.C_SetOperationState ( ulong  session,
byte[]  operationState,
ulong  operationStateLen,
ulong  encryptionKey,
ulong  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.LowLevelAPI81.Pkcs11.C_SetPIN ( ulong  session,
byte[]  oldPin,
ulong  oldPinLen,
byte[]  newPin,
ulong  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.LowLevelAPI81.Pkcs11.C_Sign ( ulong  session,
byte[]  data,
ulong  dataLen,
byte[]  signature,
ref ulong  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.LowLevelAPI81.Pkcs11.C_SignEncryptUpdate ( ulong  session,
byte[]  part,
ulong  partLen,
byte[]  encryptedPart,
ref ulong  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.LowLevelAPI81.Pkcs11.C_SignFinal ( ulong  session,
byte[]  signature,
ref ulong  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.LowLevelAPI81.Pkcs11.C_SignInit ( ulong  session,
ref CK_MECHANISM  mechanism,
ulong  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.LowLevelAPI81.Pkcs11.C_SignRecover ( ulong  session,
byte[]  data,
ulong  dataLen,
byte[]  signature,
ref ulong  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.LowLevelAPI81.Pkcs11.C_SignRecoverInit ( ulong  session,
ref CK_MECHANISM  mechanism,
ulong  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.LowLevelAPI81.Pkcs11.C_SignUpdate ( ulong  session,
byte[]  part,
ulong  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.LowLevelAPI81.Pkcs11.C_UnwrapKey ( ulong  session,
ref CK_MECHANISM  mechanism,
ulong  unwrappingKey,
byte[]  wrappedKey,
ulong  wrappedKeyLen,
CK_ATTRIBUTE[]  template,
ulong  attributeCount,
ref ulong  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.LowLevelAPI81.Pkcs11.C_Verify ( ulong  session,
byte[]  data,
ulong  dataLen,
byte[]  signature,
ulong  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.LowLevelAPI81.Pkcs11.C_VerifyFinal ( ulong  session,
byte[]  signature,
ulong  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.LowLevelAPI81.Pkcs11.C_VerifyInit ( ulong  session,
ref CK_MECHANISM  mechanism,
ulong  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.LowLevelAPI81.Pkcs11.C_VerifyRecover ( ulong  session,
byte[]  signature,
ulong  signatureLen,
byte[]  data,
ref ulong  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.LowLevelAPI81.Pkcs11.C_VerifyRecoverInit ( ulong  session,
ref CK_MECHANISM  mechanism,
ulong  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.LowLevelAPI81.Pkcs11.C_VerifyUpdate ( ulong  session,
byte[]  part,
ulong  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.LowLevelAPI81.Pkcs11.C_WaitForSlotEvent ( ulong  flags,
ref ulong  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.LowLevelAPI81.Pkcs11.C_WrapKey ( ulong  session,
ref CK_MECHANISM  mechanism,
ulong  wrappingKey,
ulong  key,
byte[]  wrappedKey,
ref ulong  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.LowLevelAPI81.Pkcs11.Dispose ( )

Disposes object

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

Disposes object

Parameters
disposingFlag indicating whether managed resources should be disposed

Property Documentation

bool Net.Pkcs11Interop.LowLevelAPI81.Pkcs11.Disposed
get

Flag indicating whether instance has been disposed

IntPtr Net.Pkcs11Interop.LowLevelAPI81.Pkcs11.LibraryHandle
get

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


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