Pkcs11Interop.PDF  1.3.0
Public Member Functions | Protected Member Functions | List of all members
Net.Pkcs11Interop.PDF.Pkcs11RsaSignature Class Reference

PKCS#1 v1.5 RSA signature creator that uses private key stored on PKCS#11 compatible device. In multithreaded environment one instance of this class should be reused by all the threads. More...

Inherits IExternalSignature, and IDisposable.

Public Member Functions

 Pkcs11RsaSignature (string libraryPath, string tokenSerial, string tokenLabel, string pin, string ckaLabel, string ckaId, HashAlgorithm hashAlgorihtm)
 Initializes a new instance of the Pkcs11Signature class More...
 
 Pkcs11RsaSignature (string libraryPath, string tokenSerial, string tokenLabel, byte[] pin, string ckaLabel, byte[] ckaId, HashAlgorithm hashAlgorihtm)
 Initializes a new instance of the Pkcs11Signature class More...
 
byte[] GetSigningCertificate ()
 Gets the raw data of certificate related to private key used for signing More...
 
List< byte[]> GetAllCertificates ()
 Gets the raw data of all certificates stored in device More...
 
byte[] GetCertificateAsByteArray ()
 Gets the raw data of certificate related to private key used for signing More...
 
Org.BouncyCastle.X509.X509Certificate GetCertificateAsX509Certificate ()
 Gets the certificate related to private key used for signing as Org.BouncyCastle.X509.X509Certificate More...
 
X509Certificate2 GetCertificateAsX509Certificate2 ()
 Gets the certificate related to private key used for signing as System.Security.Cryptography.X509Certificates.X509Certificate2 More...
 
string GetHashAlgorithm ()
 Returns the hash algorithm More...
 
string GetEncryptionAlgorithm ()
 Returns the encryption algorithm used for signing More...
 
byte[] Sign (byte[] message)
 Signs the specified message using the encryption algorithm in combination with the digest algorithm More...
 
void Dispose ()
 Disposes object More...
 

Protected Member Functions

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

Detailed Description

PKCS#1 v1.5 RSA signature creator that uses private key stored on PKCS#11 compatible device. In multithreaded environment one instance of this class should be reused by all the threads.

Constructor & Destructor Documentation

Net.Pkcs11Interop.PDF.Pkcs11RsaSignature.Pkcs11RsaSignature ( string  libraryPath,
string  tokenSerial,
string  tokenLabel,
string  pin,
string  ckaLabel,
string  ckaId,
HashAlgorithm  hashAlgorihtm 
)

Initializes a new instance of the Pkcs11Signature class

Parameters
libraryPathPath to the unmanaged PCKS#11 library
tokenSerialSerial number of the token (smartcard) that contains signing key. May be null if tokenLabel is specified.
tokenLabelLabel of of the token (smartcard) that contains signing key. May be null if tokenSerial is specified.
pinPIN for the token (smartcard)
ckaLabelLabel (value of CKA_LABEL attribute) of the private key used for signing. May be null if ckaId is specified.
ckaIdHex encoded string with identifier (value of CKA_ID attribute) of the private key used for signing. May be null if ckaLabel is specified.
hashAlgorihtmHash algorihtm used for the signature creation
Net.Pkcs11Interop.PDF.Pkcs11RsaSignature.Pkcs11RsaSignature ( string  libraryPath,
string  tokenSerial,
string  tokenLabel,
byte[]  pin,
string  ckaLabel,
byte[]  ckaId,
HashAlgorithm  hashAlgorihtm 
)

Initializes a new instance of the Pkcs11Signature class

Parameters
libraryPathPath to the unmanaged PCKS#11 library
tokenSerialSerial number of the token (smartcard) that contains signing key. May be null if tokenLabel is specified.
tokenLabelLabel of of the token (smartcard) that contains signing key. May be null if tokenSerial is specified.
pinPIN for the token (smartcard)
ckaLabelLabel (value of CKA_LABEL attribute) of the private key used for signing. May be null if ckaId is specified.
ckaIdIdentifier (value of CKA_ID attribute) of the private key used for signing. May be null if ckaLabel is specified.
hashAlgorihtmHash algorihtm used for the signature creation

Member Function Documentation

void Net.Pkcs11Interop.PDF.Pkcs11RsaSignature.Dispose ( )

Disposes object

virtual void Net.Pkcs11Interop.PDF.Pkcs11RsaSignature.Dispose ( bool  disposing)
protectedvirtual

Disposes object

Parameters
disposingFlag indicating whether managed resources should be disposed
List<byte[]> Net.Pkcs11Interop.PDF.Pkcs11RsaSignature.GetAllCertificates ( )

Gets the raw data of all certificates stored in device

Returns
Raw data of all certificates stored in device
byte [] Net.Pkcs11Interop.PDF.Pkcs11RsaSignature.GetCertificateAsByteArray ( )

Gets the raw data of certificate related to private key used for signing

Returns
Raw data of certificate related to private key used for signing
Org.BouncyCastle.X509.X509Certificate Net.Pkcs11Interop.PDF.Pkcs11RsaSignature.GetCertificateAsX509Certificate ( )

Gets the certificate related to private key used for signing as Org.BouncyCastle.X509.X509Certificate

Returns
Certificate related to private key used for signing as Org.BouncyCastle.X509.X509Certificate
X509Certificate2 Net.Pkcs11Interop.PDF.Pkcs11RsaSignature.GetCertificateAsX509Certificate2 ( )

Gets the certificate related to private key used for signing as System.Security.Cryptography.X509Certificates.X509Certificate2

Returns
Certificate related to private key used for signing as System.Security.Cryptography.X509Certificates.X509Certificate2
string Net.Pkcs11Interop.PDF.Pkcs11RsaSignature.GetEncryptionAlgorithm ( )

Returns the encryption algorithm used for signing

Returns
The encryption algorithm ("RSA")
string Net.Pkcs11Interop.PDF.Pkcs11RsaSignature.GetHashAlgorithm ( )

Returns the hash algorithm

Returns
The hash algorithm ("SHA1", "SHA256", ...)
byte [] Net.Pkcs11Interop.PDF.Pkcs11RsaSignature.GetSigningCertificate ( )

Gets the raw data of certificate related to private key used for signing

Returns
Raw data of certificate related to private key used for signing
byte [] Net.Pkcs11Interop.PDF.Pkcs11RsaSignature.Sign ( byte[]  message)

Signs the specified message using the encryption algorithm in combination with the digest algorithm

Parameters
messagethe message you want to be hashed and signed
Returns
A signed message digest

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