PdfPkcs11Token Class
Represents the logical view of a cryptographic device defined by Cryptoki.
Various objects can be stored on a token. These include data, certificates and keys.
important
Stored objects can be accessed and cryptographic functions performed only after the session (a logical connection between an application and a token) is opened. The PdfPkcs11Token implicitly opens the session when required, and reuses the opened session until the PdfPkcs11Token is disposed.
The session can be opened only on the thread the PdfPkcs11Token was created on. To open a session on another thread, Clone() the PdfPkcs11Token, use the clone with its own session, and dispose the clone.
PdfPkcs11Token associates a single session with itself because Cryptoki doesn't guarantee that a particular object on a token has a handle which is fixed for the lifetime of the object; however, if a particular session can use a particular handle to access a particular object, then that session will continue to be able to use that handle to access that object as long as the session continues to exist, the object continues to exist, and the object continues to be accessible to the session. PdfPkcs11Token uses object handles to access private keys, public keys, and certificates contained on the token in order to build the DigitalIds and, therefore, this must be done in the scope of a single session.
public sealed class PdfPkcs11Token : IDisposable
Public NotInheritable Class PdfPkcs11Token
Implements IDisposable
- Inheritance:
- System.ObjectPdfPkcs11Token
Implements
Properties
DigitalIds
Gets the digital IDs contained on this token.
public IList<PdfPkcs11DigitalId> DigitalIds { get; }
Public ReadOnly Property DigitalIds As IList(Of PdfPkcs11DigitalId)
Property Value
- System.Collections.Generic.IList<PdfPkcs11DigitalId>
The digital IDs contained on this token.
Model
Gets the model of the device.
Property Value
- System.String
The model of the device.
ModuleManufacturerId
Gets the ID of the device manufacturer.
public string ModuleManufacturerId { get; }
Public ReadOnly Property ModuleManufacturerId As String
Property Value
- System.String
The ID of the device manufacturer.
SerialNumber
Gets the serial number of the device.
Property Value
- System.String
The serial number of the device.
TokenLabel
Gets the application-defined label, assigned during token initialization.
Property Value
- System.String
The application-defined label, assigned during token initialization.
Methods
Clone()
Clones the PdfPkcs11Token so that the returned clone can rebuild its DigitalIds using its own session on another thread. For more information about Cryptoki sessions, read the documentation of the PdfPkcs11Token class.
important
After you are finished using the cloned PdfPkcs11Token make sure you dispose it so that its associated session is closed.
Returns
The clone of the PdfPkcs11Token whose session can be used on another thread.
Login(String)
Logs a user into a token.
Parameters
pin
- System.String
The user's Personal Identification Number (PIN).
Remarks
Since all sessions an application has with a token have a shared login state, Login(String) only needs to be called for one of the sessions (source). If the PdfPkcs11Token is going to be used from multiple threads concurrently, then there should be one master PdfPkcs11Token on which the Login(String) should be called once and PdfPkcs11Token instances returned by the Clone() method on the master PdfPkcs11Token should be used in each thread.
See Also
Logout()
Logs a user out from a token.
See Also
ToString()
Returns a System.String that represents this PdfPkcs11Module instance.
Returns
- System.String
A System.String that represents this PdfPkcs11Module instance.
Overrides
Remarks
This method should be used primarily for debugging purposes and should be considered volatile (format of its return value might change in future versions).