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

Class representing a logical connection between an application and a token More...

Inherits IDisposable.

Public Member Functions

void CloseSession ()
 Closes a session between an application and a token More...
 
void InitPin (string userPin)
 Initializes the normal user's PIN More...
 
void InitPin (byte[] userPin)
 Initializes the normal user's PIN More...
 
void SetPin (string oldPin, string newPin)
 Modifies the PIN of the user that is currently logged in, or the CKU_USER PIN if the session is not logged in. More...
 
void SetPin (byte[] oldPin, byte[] newPin)
 Modifies the PIN of the user that is currently logged in, or the CKU_USER PIN if the session is not logged in. More...
 
SessionInfo GetSessionInfo ()
 Obtains information about a session More...
 
byte[] GetOperationState ()
 Obtains a copy of the cryptographic operations state of a session encoded as an array of bytes More...
 
void SetOperationState (byte[] state, ObjectHandle encryptionKey, ObjectHandle authenticationKey)
 Restores the cryptographic operations state of a session from an array of bytes obtained with GetOperationState More...
 
void Login (CKU userType, string pin)
 Logs a user into a token More...
 
void Login (CKU userType, byte[] pin)
 Logs a user into a token More...
 
void Logout ()
 Logs a user out from a token More...
 
ObjectHandle CreateObject (List< ObjectAttribute > attributes)
 Creates a new object More...
 
ObjectHandle CopyObject (ObjectHandle objectHandle, List< ObjectAttribute > attributes)
 Copies an object, creating a new object for the copy More...
 
void DestroyObject (ObjectHandle objectHandle)
 Destroys an object More...
 
uint GetObjectSize (ObjectHandle objectHandle)
 Gets the size of an object in bytes. More...
 
List< ObjectAttributeGetAttributeValue (ObjectHandle objectHandle, List< CKA > attributes)
 Obtains the value of one or more attributes of an object More...
 
List< ObjectAttributeGetAttributeValue (ObjectHandle objectHandle, List< uint > attributes)
 Obtains the value of one or more attributes of an object More...
 
void SetAttributeValue (ObjectHandle objectHandle, List< ObjectAttribute > attributes)
 Modifies the value of one or more attributes of an object More...
 
void FindObjectsInit (List< ObjectAttribute > attributes)
 Initializes a search for token and session objects that match a attributes More...
 
List< ObjectHandleFindObjects (int objectCount)
 Continues a search for token and session objects that match a template, obtaining additional object handles More...
 
void FindObjectsFinal ()
 Terminates a search for token and session objects More...
 
List< ObjectHandleFindAllObjects (List< ObjectAttribute > attributes)
 Searches for all token and session objects that match provided attributes More...
 
byte[] Encrypt (Mechanism mechanism, ObjectHandle keyHandle, byte[] data)
 Encrypts single-part data More...
 
void Encrypt (Mechanism mechanism, ObjectHandle keyHandle, Stream inputStream, Stream outputStream)
 Encrypts multi-part data More...
 
void Encrypt (Mechanism mechanism, ObjectHandle keyHandle, Stream inputStream, Stream outputStream, int bufferLength)
 Encrypts multi-part data More...
 
byte[] Decrypt (Mechanism mechanism, ObjectHandle keyHandle, byte[] encryptedData)
 Decrypts single-part data More...
 
void Decrypt (Mechanism mechanism, ObjectHandle keyHandle, Stream inputStream, Stream outputStream)
 Decrypts multi-part data More...
 
void Decrypt (Mechanism mechanism, ObjectHandle keyHandle, Stream inputStream, Stream outputStream, int bufferLength)
 Decrypts multi-part data More...
 
byte[] DigestKey (Mechanism mechanism, ObjectHandle keyHandle)
 Digests the value of a secret key More...
 
byte[] Digest (Mechanism mechanism, byte[] data)
 Digests single-part data More...
 
byte[] Digest (Mechanism mechanism, Stream inputStream)
 Digests multi-part data More...
 
byte[] Digest (Mechanism mechanism, Stream inputStream, int bufferLength)
 Digests multi-part data More...
 
byte[] Sign (Mechanism mechanism, ObjectHandle keyHandle, byte[] data)
 Signs single-part data, where the signature is an appendix to the data More...
 
byte[] Sign (Mechanism mechanism, ObjectHandle keyHandle, Stream inputStream)
 Signs multi-part data, where the signature is an appendix to the data More...
 
byte[] Sign (Mechanism mechanism, ObjectHandle keyHandle, Stream inputStream, int bufferLength)
 Signs multi-part data, where the signature is an appendix to the data More...
 
byte[] SignRecover (Mechanism mechanism, ObjectHandle keyHandle, byte[] data)
 Signs single-part data, where the data can be recovered from the signature More...
 
void Verify (Mechanism mechanism, ObjectHandle keyHandle, byte[] data, byte[] signature, out bool isValid)
 Verifies a signature of data, where the signature is an appendix to the data More...
 
void Verify (Mechanism mechanism, ObjectHandle keyHandle, Stream inputStream, byte[] signature, out bool isValid)
 Verifies a signature of data, where the signature is an appendix to the data More...
 
void Verify (Mechanism mechanism, ObjectHandle keyHandle, Stream inputStream, byte[] signature, out bool isValid, int bufferLength)
 Verifies a signature of data, where the signature is an appendix to the data More...
 
byte[] VerifyRecover (Mechanism mechanism, ObjectHandle keyHandle, byte[] signature, out bool isValid)
 Verifies signature of data, where the data can be recovered from the signature More...
 
void DigestEncrypt (Mechanism digestingMechanism, Mechanism encryptionMechanism, ObjectHandle keyHandle, byte[] data, out byte[] digest, out byte[] encryptedData)
 Digests and encrypts data More...
 
byte[] DigestEncrypt (Mechanism digestingMechanism, Mechanism encryptionMechanism, ObjectHandle keyHandle, Stream inputStream, Stream outputStream)
 Digests and encrypts data More...
 
byte[] DigestEncrypt (Mechanism digestingMechanism, Mechanism encryptionMechanism, ObjectHandle keyHandle, Stream inputStream, Stream outputStream, int bufferLength)
 Digests and encrypts data More...
 
void DecryptDigest (Mechanism digestingMechanism, Mechanism decryptionMechanism, ObjectHandle keyHandle, byte[] data, out byte[] digest, out byte[] decryptedData)
 Digests and decrypts data More...
 
byte[] DecryptDigest (Mechanism digestingMechanism, Mechanism decryptionMechanism, ObjectHandle keyHandle, Stream inputStream, Stream outputStream)
 Digests and decrypts data More...
 
byte[] DecryptDigest (Mechanism digestingMechanism, Mechanism decryptionMechanism, ObjectHandle keyHandle, Stream inputStream, Stream outputStream, int bufferLength)
 Digests and decrypts data More...
 
void SignEncrypt (Mechanism signingMechanism, ObjectHandle signingKeyHandle, Mechanism encryptionMechanism, ObjectHandle encryptionKeyHandle, byte[] data, out byte[] signature, out byte[] encryptedData)
 Signs and encrypts data More...
 
byte[] SignEncrypt (Mechanism signingMechanism, ObjectHandle signingKeyHandle, Mechanism encryptionMechanism, ObjectHandle encryptionKeyHandle, Stream inputStream, Stream outputStream)
 Signs and encrypts data More...
 
byte[] SignEncrypt (Mechanism signingMechanism, ObjectHandle signingKeyHandle, Mechanism encryptionMechanism, ObjectHandle encryptionKeyHandle, Stream inputStream, Stream outputStream, int bufferLength)
 Signs and encrypts data More...
 
void DecryptVerify (Mechanism verificationMechanism, ObjectHandle verificationKeyHandle, Mechanism decryptionMechanism, ObjectHandle decryptionKeyHandle, byte[] data, byte[] signature, out byte[] decryptedData, out bool isValid)
 Decrypts data and verifies a signature of data More...
 
void DecryptVerify (Mechanism verificationMechanism, ObjectHandle verificationKeyHandle, Mechanism decryptionMechanism, ObjectHandle decryptionKeyHandle, Stream inputStream, Stream outputStream, byte[] signature, out bool isValid)
 Decrypts data and verifies a signature of data More...
 
void DecryptVerify (Mechanism verificationMechanism, ObjectHandle verificationKeyHandle, Mechanism decryptionMechanism, ObjectHandle decryptionKeyHandle, Stream inputStream, Stream outputStream, byte[] signature, out bool isValid, int bufferLength)
 Decrypts data and verifies a signature of data More...
 
ObjectHandle GenerateKey (Mechanism mechanism, List< ObjectAttribute > attributes)
 Generates a secret key or set of domain parameters, creating a new object More...
 
void GenerateKeyPair (Mechanism mechanism, List< ObjectAttribute > publicKeyAttributes, List< ObjectAttribute > privateKeyAttributes, out ObjectHandle publicKeyHandle, out ObjectHandle privateKeyHandle)
 Generates a public/private key pair, creating new key objects More...
 
byte[] WrapKey (Mechanism mechanism, ObjectHandle wrappingKeyHandle, ObjectHandle keyHandle)
 Wraps (i.e., encrypts) a private or secret key More...
 
ObjectHandle UnwrapKey (Mechanism mechanism, ObjectHandle unwrappingKeyHandle, byte[] wrappedKey, List< ObjectAttribute > attributes)
 Unwraps (i.e. decrypts) a wrapped key, creating a new private key or secret key object More...
 
ObjectHandle DeriveKey (Mechanism mechanism, ObjectHandle baseKeyHandle, List< ObjectAttribute > attributes)
 Derives a key from a base key, creating a new key object More...
 
void SeedRandom (byte[] seed)
 Mixes additional seed material into the token's random number generator More...
 
byte[] GenerateRandom (int length)
 Generates random or pseudo-random data More...
 
void GetFunctionStatus ()
 Legacy function which should throw CKR_FUNCTION_NOT_PARALLEL More...
 
void CancelFunction ()
 Legacy function which should throw CKR_FUNCTION_NOT_PARALLEL 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...
 
LowLevelAPI41.Pkcs11 LowLevelPkcs11 [get]
 Low level PKCS#11 wrapper. Use with caution! More...
 
uint SessionId [get]
 PKCS#11 handle of session More...
 
bool CloseWhenDisposed [get, set]
 Flag indicating whether session should be closed when object is disposed More...
 

Detailed Description

Class representing a logical connection between an application and a token

Member Function Documentation

void Net.Pkcs11Interop.HighLevelAPI41.Session.CancelFunction ( )

Legacy function which should throw CKR_FUNCTION_NOT_PARALLEL

void Net.Pkcs11Interop.HighLevelAPI41.Session.CloseSession ( )

Closes a session between an application and a token

ObjectHandle Net.Pkcs11Interop.HighLevelAPI41.Session.CopyObject ( ObjectHandle  objectHandle,
List< ObjectAttribute attributes 
)

Copies an object, creating a new object for the copy

Parameters
objectHandleHandle of object to be copied
attributesNew values for any attributes of the object that can ordinarily be modified
Returns
Handle of copied object
ObjectHandle Net.Pkcs11Interop.HighLevelAPI41.Session.CreateObject ( List< ObjectAttribute attributes)

Creates a new object

Parameters
attributesObject attributes
Returns
Handle of created object
byte [] Net.Pkcs11Interop.HighLevelAPI41.Session.Decrypt ( Mechanism  mechanism,
ObjectHandle  keyHandle,
byte[]  encryptedData 
)

Decrypts single-part data

Parameters
mechanismDecryption mechanism
keyHandleHandle of the decryption key
encryptedDataData to be decrypted
Returns
Decrypted data
void Net.Pkcs11Interop.HighLevelAPI41.Session.Decrypt ( Mechanism  mechanism,
ObjectHandle  keyHandle,
Stream  inputStream,
Stream  outputStream 
)

Decrypts multi-part data

Parameters
mechanismDecryption mechanism
keyHandleHandle of the decryption key
inputStreamInput stream from which encrypted data should be read
outputStreamOutput stream where decrypted data should be written
void Net.Pkcs11Interop.HighLevelAPI41.Session.Decrypt ( Mechanism  mechanism,
ObjectHandle  keyHandle,
Stream  inputStream,
Stream  outputStream,
int  bufferLength 
)

Decrypts multi-part data

Parameters
mechanismDecryption mechanism
keyHandleHandle of the decryption key
inputStreamInput stream from which encrypted data should be read
outputStreamOutput stream where decrypted data should be written
bufferLengthSize of read buffer in bytes
void Net.Pkcs11Interop.HighLevelAPI41.Session.DecryptDigest ( Mechanism  digestingMechanism,
Mechanism  decryptionMechanism,
ObjectHandle  keyHandle,
byte[]  data,
out byte[]  digest,
out byte[]  decryptedData 
)

Digests and decrypts data

Parameters
digestingMechanismDigesting mechanism
decryptionMechanismDecryption mechanism
keyHandleHandle of the decryption key
dataData to be processed
digestDigest
decryptedDataDecrypted data
byte [] Net.Pkcs11Interop.HighLevelAPI41.Session.DecryptDigest ( Mechanism  digestingMechanism,
Mechanism  decryptionMechanism,
ObjectHandle  keyHandle,
Stream  inputStream,
Stream  outputStream 
)

Digests and decrypts data

Parameters
digestingMechanismDigesting mechanism
decryptionMechanismDecryption mechanism
keyHandleHandle of the decryption key
inputStreamInput stream from which data to be processed should be read
outputStreamOutput stream where decrypted data should be written
Returns
Digest
byte [] Net.Pkcs11Interop.HighLevelAPI41.Session.DecryptDigest ( Mechanism  digestingMechanism,
Mechanism  decryptionMechanism,
ObjectHandle  keyHandle,
Stream  inputStream,
Stream  outputStream,
int  bufferLength 
)

Digests and decrypts data

Parameters
digestingMechanismDigesting mechanism
decryptionMechanismDecryption mechanism
keyHandleHandle of the decryption key
inputStreamInput stream from which data to be processed should be read
outputStreamOutput stream where decrypted data should be written
bufferLengthSize of read buffer in bytes
Returns
Digest
void Net.Pkcs11Interop.HighLevelAPI41.Session.DecryptVerify ( Mechanism  verificationMechanism,
ObjectHandle  verificationKeyHandle,
Mechanism  decryptionMechanism,
ObjectHandle  decryptionKeyHandle,
byte[]  data,
byte[]  signature,
out byte[]  decryptedData,
out bool  isValid 
)

Decrypts data and verifies a signature of data

Parameters
verificationMechanismVerification mechanism
verificationKeyHandleHandle of the verification key
decryptionMechanismDecryption mechanism
decryptionKeyHandleHandle of the decryption key
dataData to be processed
signatureSignature
decryptedDataDecrypted data
isValidFlag indicating whether signature is valid
void Net.Pkcs11Interop.HighLevelAPI41.Session.DecryptVerify ( Mechanism  verificationMechanism,
ObjectHandle  verificationKeyHandle,
Mechanism  decryptionMechanism,
ObjectHandle  decryptionKeyHandle,
Stream  inputStream,
Stream  outputStream,
byte[]  signature,
out bool  isValid 
)

Decrypts data and verifies a signature of data

Parameters
verificationMechanismVerification mechanism
verificationKeyHandleHandle of the verification key
decryptionMechanismDecryption mechanism
decryptionKeyHandleHandle of the decryption key
inputStreamInput stream from which data to be processed should be read
outputStreamOutput stream where decrypted data should be written
signatureSignature
isValidFlag indicating whether signature is valid
void Net.Pkcs11Interop.HighLevelAPI41.Session.DecryptVerify ( Mechanism  verificationMechanism,
ObjectHandle  verificationKeyHandle,
Mechanism  decryptionMechanism,
ObjectHandle  decryptionKeyHandle,
Stream  inputStream,
Stream  outputStream,
byte[]  signature,
out bool  isValid,
int  bufferLength 
)

Decrypts data and verifies a signature of data

Parameters
verificationMechanismVerification mechanism
verificationKeyHandleHandle of the verification key
decryptionMechanismDecryption mechanism
decryptionKeyHandleHandle of the decryption key
inputStreamInput stream from which data to be processed should be read
outputStreamOutput stream where decrypted data should be written
signatureSignature
isValidFlag indicating whether signature is valid
bufferLengthSize of read buffer in bytes
ObjectHandle Net.Pkcs11Interop.HighLevelAPI41.Session.DeriveKey ( Mechanism  mechanism,
ObjectHandle  baseKeyHandle,
List< ObjectAttribute attributes 
)

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

Parameters
mechanismDerivation mechanism
baseKeyHandleHandle of base key
attributesAttributes for the new key
Returns
Handle of derived key
void Net.Pkcs11Interop.HighLevelAPI41.Session.DestroyObject ( ObjectHandle  objectHandle)

Destroys an object

Parameters
objectHandleHandle of object to be destroyed
byte [] Net.Pkcs11Interop.HighLevelAPI41.Session.Digest ( Mechanism  mechanism,
byte[]  data 
)

Digests single-part data

Parameters
mechanismDigesting mechanism
dataData to be digested
Returns
Digest
byte [] Net.Pkcs11Interop.HighLevelAPI41.Session.Digest ( Mechanism  mechanism,
Stream  inputStream 
)

Digests multi-part data

Parameters
mechanismDigesting mechanism
inputStreamInput stream from which data should be read
Returns
Digest
byte [] Net.Pkcs11Interop.HighLevelAPI41.Session.Digest ( Mechanism  mechanism,
Stream  inputStream,
int  bufferLength 
)

Digests multi-part data

Parameters
mechanismDigesting mechanism
inputStreamInput stream from which data should be read
bufferLengthSize of read buffer in bytes
Returns
Digest
void Net.Pkcs11Interop.HighLevelAPI41.Session.DigestEncrypt ( Mechanism  digestingMechanism,
Mechanism  encryptionMechanism,
ObjectHandle  keyHandle,
byte[]  data,
out byte[]  digest,
out byte[]  encryptedData 
)

Digests and encrypts data

Parameters
digestingMechanismDigesting mechanism
encryptionMechanismEncryption mechanism
keyHandleHandle of the encryption key
dataData to be processed
digestDigest
encryptedDataEncrypted data
byte [] Net.Pkcs11Interop.HighLevelAPI41.Session.DigestEncrypt ( Mechanism  digestingMechanism,
Mechanism  encryptionMechanism,
ObjectHandle  keyHandle,
Stream  inputStream,
Stream  outputStream 
)

Digests and encrypts data

Parameters
digestingMechanismDigesting mechanism
encryptionMechanismEncryption mechanism
keyHandleHandle of the encryption key
inputStreamInput stream from which data to be processed should be read
outputStreamOutput stream where encrypted data should be written
Returns
Digest
byte [] Net.Pkcs11Interop.HighLevelAPI41.Session.DigestEncrypt ( Mechanism  digestingMechanism,
Mechanism  encryptionMechanism,
ObjectHandle  keyHandle,
Stream  inputStream,
Stream  outputStream,
int  bufferLength 
)

Digests and encrypts data

Parameters
digestingMechanismDigesting mechanism
encryptionMechanismEncryption mechanism
keyHandleHandle of the encryption key
inputStreamInput stream from which data to be processed should be read
outputStreamOutput stream where encrypted data should be written
bufferLengthSize of read buffer in bytes
Returns
Digest
byte [] Net.Pkcs11Interop.HighLevelAPI41.Session.DigestKey ( Mechanism  mechanism,
ObjectHandle  keyHandle 
)

Digests the value of a secret key

Parameters
mechanismDigesting mechanism
keyHandleHandle of the secret key to be digested
Returns
Digest
void Net.Pkcs11Interop.HighLevelAPI41.Session.Dispose ( )

Disposes object

virtual void Net.Pkcs11Interop.HighLevelAPI41.Session.Dispose ( bool  disposing)
protectedvirtual

Disposes object

Parameters
disposingFlag indicating whether managed resources should be disposed
byte [] Net.Pkcs11Interop.HighLevelAPI41.Session.Encrypt ( Mechanism  mechanism,
ObjectHandle  keyHandle,
byte[]  data 
)

Encrypts single-part data

Parameters
mechanismEncryption mechanism
keyHandleHandle of the encryption key
dataData to be encrypted
Returns
Encrypted data
void Net.Pkcs11Interop.HighLevelAPI41.Session.Encrypt ( Mechanism  mechanism,
ObjectHandle  keyHandle,
Stream  inputStream,
Stream  outputStream 
)

Encrypts multi-part data

Parameters
mechanismEncryption mechanism
keyHandleHandle of the encryption key
inputStreamInput stream from which data to be encrypted should be read
outputStreamOutput stream where encrypted data should be written
void Net.Pkcs11Interop.HighLevelAPI41.Session.Encrypt ( Mechanism  mechanism,
ObjectHandle  keyHandle,
Stream  inputStream,
Stream  outputStream,
int  bufferLength 
)

Encrypts multi-part data

Parameters
mechanismEncryption mechanism
keyHandleHandle of the encryption key
inputStreamInput stream from which data to be encrypted should be read
outputStreamOutput stream where encrypted data should be written
bufferLengthSize of read buffer in bytes
List<ObjectHandle> Net.Pkcs11Interop.HighLevelAPI41.Session.FindAllObjects ( List< ObjectAttribute attributes)

Searches for all token and session objects that match provided attributes

Parameters
attributesAttributes that should be matched
Returns
Handles of found objects
List<ObjectHandle> Net.Pkcs11Interop.HighLevelAPI41.Session.FindObjects ( int  objectCount)

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

Parameters
objectCountMaximum number of object handles to be returned
Returns
Found object handles
void Net.Pkcs11Interop.HighLevelAPI41.Session.FindObjectsFinal ( )

Terminates a search for token and session objects

void Net.Pkcs11Interop.HighLevelAPI41.Session.FindObjectsInit ( List< ObjectAttribute attributes)

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

Parameters
attributesAttributes that should be matched
ObjectHandle Net.Pkcs11Interop.HighLevelAPI41.Session.GenerateKey ( Mechanism  mechanism,
List< ObjectAttribute attributes 
)

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

Parameters
mechanismGeneration mechanism
attributesAttributes of the new key or set of domain parameters
Returns
Handle of the new key or set of domain parameters
void Net.Pkcs11Interop.HighLevelAPI41.Session.GenerateKeyPair ( Mechanism  mechanism,
List< ObjectAttribute publicKeyAttributes,
List< ObjectAttribute privateKeyAttributes,
out ObjectHandle  publicKeyHandle,
out ObjectHandle  privateKeyHandle 
)

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

Parameters
mechanismKey generation mechanism
publicKeyAttributesAttributes of the public key
privateKeyAttributesAttributes of the private key
publicKeyHandleHandle of the new public key
privateKeyHandleHandle of the new private key
byte [] Net.Pkcs11Interop.HighLevelAPI41.Session.GenerateRandom ( int  length)

Generates random or pseudo-random data

Parameters
lengthLength in bytes of the random or pseudo-random data to be generated
Returns
Generated random or pseudo-random data
List<ObjectAttribute> Net.Pkcs11Interop.HighLevelAPI41.Session.GetAttributeValue ( ObjectHandle  objectHandle,
List< CKA attributes 
)

Obtains the value of one or more attributes of an object

Parameters
objectHandleHandle of object whose attributes should be read
attributesList of attributes that should be read
Returns
Object attributes
List<ObjectAttribute> Net.Pkcs11Interop.HighLevelAPI41.Session.GetAttributeValue ( ObjectHandle  objectHandle,
List< uint >  attributes 
)

Obtains the value of one or more attributes of an object

Parameters
objectHandleHandle of object whose attributes should be read
attributesList of attributes that should be read
Returns
Object attributes
void Net.Pkcs11Interop.HighLevelAPI41.Session.GetFunctionStatus ( )

Legacy function which should throw CKR_FUNCTION_NOT_PARALLEL

uint Net.Pkcs11Interop.HighLevelAPI41.Session.GetObjectSize ( ObjectHandle  objectHandle)

Gets the size of an object in bytes.

Parameters
objectHandleHandle of object
Returns
Size of an object in bytes
byte [] Net.Pkcs11Interop.HighLevelAPI41.Session.GetOperationState ( )

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

Returns
Operations state of a session
SessionInfo Net.Pkcs11Interop.HighLevelAPI41.Session.GetSessionInfo ( )

Obtains information about a session

Returns
Information about a session
void Net.Pkcs11Interop.HighLevelAPI41.Session.InitPin ( string  userPin)

Initializes the normal user's PIN

Parameters
userPinPin value
void Net.Pkcs11Interop.HighLevelAPI41.Session.InitPin ( byte[]  userPin)

Initializes the normal user's PIN

Parameters
userPinPin value
void Net.Pkcs11Interop.HighLevelAPI41.Session.Login ( CKU  userType,
string  pin 
)

Logs a user into a token

Parameters
userTypeType of user
pinPin of user
void Net.Pkcs11Interop.HighLevelAPI41.Session.Login ( CKU  userType,
byte[]  pin 
)

Logs a user into a token

Parameters
userTypeType of user
pinPin of user
void Net.Pkcs11Interop.HighLevelAPI41.Session.Logout ( )

Logs a user out from a token

void Net.Pkcs11Interop.HighLevelAPI41.Session.SeedRandom ( byte[]  seed)

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

Parameters
seedSeed material
void Net.Pkcs11Interop.HighLevelAPI41.Session.SetAttributeValue ( ObjectHandle  objectHandle,
List< ObjectAttribute attributes 
)

Modifies the value of one or more attributes of an object

Parameters
objectHandleHandle of object whose attributes should be modified
attributesList of attributes that should be modified
void Net.Pkcs11Interop.HighLevelAPI41.Session.SetOperationState ( byte[]  state,
ObjectHandle  encryptionKey,
ObjectHandle  authenticationKey 
)

Restores the cryptographic operations state of a session from an array of bytes obtained with GetOperationState

Parameters
stateArray of bytes obtained with GetOperationState
encryptionKeyCK_INVALID_HANDLE or handle to the key which will be used for an ongoing encryption or decryption operation in the restored session
authenticationKeyCK_INVALID_HANDLE or handle to the key which will be used for an ongoing signature, MACing, or verification operation in the restored session
void Net.Pkcs11Interop.HighLevelAPI41.Session.SetPin ( string  oldPin,
string  newPin 
)

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

Parameters
oldPinOld PIN value
newPinNew PIN value
void Net.Pkcs11Interop.HighLevelAPI41.Session.SetPin ( byte[]  oldPin,
byte[]  newPin 
)

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

Parameters
oldPinOld PIN value
newPinNew PIN value
byte [] Net.Pkcs11Interop.HighLevelAPI41.Session.Sign ( Mechanism  mechanism,
ObjectHandle  keyHandle,
byte[]  data 
)

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

Parameters
mechanismSignature mechanism
keyHandleSignature key
dataData to be signed
Returns
Signature
byte [] Net.Pkcs11Interop.HighLevelAPI41.Session.Sign ( Mechanism  mechanism,
ObjectHandle  keyHandle,
Stream  inputStream 
)

Signs multi-part data, where the signature is an appendix to the data

Parameters
mechanismSignature mechanism
keyHandleSignature key
inputStreamInput stream from which data should be read
Returns
Signature
byte [] Net.Pkcs11Interop.HighLevelAPI41.Session.Sign ( Mechanism  mechanism,
ObjectHandle  keyHandle,
Stream  inputStream,
int  bufferLength 
)

Signs multi-part data, where the signature is an appendix to the data

Parameters
mechanismSignature mechanism
keyHandleSignature key
inputStreamInput stream from which data should be read
bufferLengthSize of read buffer in bytes
Returns
Signature
void Net.Pkcs11Interop.HighLevelAPI41.Session.SignEncrypt ( Mechanism  signingMechanism,
ObjectHandle  signingKeyHandle,
Mechanism  encryptionMechanism,
ObjectHandle  encryptionKeyHandle,
byte[]  data,
out byte[]  signature,
out byte[]  encryptedData 
)

Signs and encrypts data

Parameters
signingMechanismSigning mechanism
signingKeyHandleHandle of the signing key
encryptionMechanismEncryption mechanism
encryptionKeyHandleHandle of the encryption key
dataData to be processed
signatureSignature
encryptedDataEncrypted data
byte [] Net.Pkcs11Interop.HighLevelAPI41.Session.SignEncrypt ( Mechanism  signingMechanism,
ObjectHandle  signingKeyHandle,
Mechanism  encryptionMechanism,
ObjectHandle  encryptionKeyHandle,
Stream  inputStream,
Stream  outputStream 
)

Signs and encrypts data

Parameters
signingMechanismSigning mechanism
signingKeyHandleHandle of the signing key
encryptionMechanismEncryption mechanism
encryptionKeyHandleHandle of the encryption key
inputStreamInput stream from which data to be processed should be read
outputStreamOutput stream where encrypted data should be written
Returns
Signature
byte [] Net.Pkcs11Interop.HighLevelAPI41.Session.SignEncrypt ( Mechanism  signingMechanism,
ObjectHandle  signingKeyHandle,
Mechanism  encryptionMechanism,
ObjectHandle  encryptionKeyHandle,
Stream  inputStream,
Stream  outputStream,
int  bufferLength 
)

Signs and encrypts data

Parameters
signingMechanismSigning mechanism
signingKeyHandleHandle of the signing key
encryptionMechanismEncryption mechanism
encryptionKeyHandleHandle of the encryption key
inputStreamInput stream from which data to be processed should be read
outputStreamOutput stream where encrypted data should be written
bufferLengthSize of read buffer in bytes
Returns
Signature
byte [] Net.Pkcs11Interop.HighLevelAPI41.Session.SignRecover ( Mechanism  mechanism,
ObjectHandle  keyHandle,
byte[]  data 
)

Signs single-part data, where the data can be recovered from the signature

Parameters
mechanismSignature mechanism
keyHandleSignature key
dataData to be signed
Returns
Signature
ObjectHandle Net.Pkcs11Interop.HighLevelAPI41.Session.UnwrapKey ( Mechanism  mechanism,
ObjectHandle  unwrappingKeyHandle,
byte[]  wrappedKey,
List< ObjectAttribute attributes 
)

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

Parameters
mechanismUnwrapping mechanism
unwrappingKeyHandleHandle of unwrapping key
wrappedKeyWrapped key
attributesAttributes for unwrapped key
Returns
Handle of unwrapped key
void Net.Pkcs11Interop.HighLevelAPI41.Session.Verify ( Mechanism  mechanism,
ObjectHandle  keyHandle,
byte[]  data,
byte[]  signature,
out bool  isValid 
)

Verifies a signature of data, where the signature is an appendix to the data

Parameters
mechanismVerification mechanism;
keyHandleVerification key
dataData that was signed
signatureSignature
isValidFlag indicating whether signature is valid
void Net.Pkcs11Interop.HighLevelAPI41.Session.Verify ( Mechanism  mechanism,
ObjectHandle  keyHandle,
Stream  inputStream,
byte[]  signature,
out bool  isValid 
)

Verifies a signature of data, where the signature is an appendix to the data

Parameters
mechanismVerification mechanism;
keyHandleVerification key
inputStreamInput stream from which data that was signed should be read
signatureSignature
isValidFlag indicating whether signature is valid
void Net.Pkcs11Interop.HighLevelAPI41.Session.Verify ( Mechanism  mechanism,
ObjectHandle  keyHandle,
Stream  inputStream,
byte[]  signature,
out bool  isValid,
int  bufferLength 
)

Verifies a signature of data, where the signature is an appendix to the data

Parameters
mechanismVerification mechanism;
keyHandleVerification key
inputStreamInput stream from which data that was signed should be read
signatureSignature
isValidFlag indicating whether signature is valid
bufferLengthSize of read buffer in bytes
byte [] Net.Pkcs11Interop.HighLevelAPI41.Session.VerifyRecover ( Mechanism  mechanism,
ObjectHandle  keyHandle,
byte[]  signature,
out bool  isValid 
)

Verifies signature of data, where the data can be recovered from the signature

Parameters
mechanismVerification mechanism;
keyHandleVerification key
signatureSignature
isValidFlag indicating whether signature is valid
Returns
Data recovered from the signature
byte [] Net.Pkcs11Interop.HighLevelAPI41.Session.WrapKey ( Mechanism  mechanism,
ObjectHandle  wrappingKeyHandle,
ObjectHandle  keyHandle 
)

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

Parameters
mechanismWrapping mechanism
wrappingKeyHandleHandle of wrapping key
keyHandleHandle of key to be wrapped
Returns
Wrapped key

Property Documentation

bool Net.Pkcs11Interop.HighLevelAPI41.Session.CloseWhenDisposed
getset

Flag indicating whether session should be closed when object is disposed

bool Net.Pkcs11Interop.HighLevelAPI41.Session.Disposed
get

Flag indicating whether instance has been disposed

LowLevelAPI41.Pkcs11 Net.Pkcs11Interop.HighLevelAPI41.Session.LowLevelPkcs11
get

Low level PKCS#11 wrapper. Use with caution!

uint Net.Pkcs11Interop.HighLevelAPI41.Session.SessionId
get

PKCS#11 handle of session


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