GemBox.Pdf
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    PdfDigitalId Class

    Namespace:
    GemBox.Pdf.Security
    Assembly:
    GemBox.Pdf.dll

    A digital ID used to sign and encrypt documents.

    The certificate that comes with your digital ID is sent to others so that they can verify your signature.

    The most secure digital IDs are issued by trusted Certificate authorities and are based on secure devices like smart card or token. Some are based on files.

    • C#
    • VB.NET
    public class PdfDigitalId
    Public Class PdfDigitalId
    Inheritance:
    System.Object
    PdfDigitalId
    Derived
    PdfDelayOrReSignDigitalId
    PdfPkcs11DigitalId
    Remarks

    GemBox.Pdf doesn't use System.Security.Cryptography.X509Certificates.X509Certificate2 class to represent a digital ID because System.Security.Cryptography.X509Certificates.X509Certificate2 creates a file that holds the private key and another file that holds the certificate with the public key (in various locations on a hard drive) and on some operating systems and platforms those files are not deleted unless System.Security.Cryptography.X509Certificates.X509Certificate2.Reset method is called.

    Another reason why GemBox.Pdf abstracts a digital ID with a PdfDigitalId class instead of using System.Security.Cryptography.X509Certificates.X509Certificate2 directly is to enable different implementations of a digital ID. For example, either System.Security.Cryptography.X509Certificates.X509Certificate2 implementation from .NET or Org.BouncyCastle.X509.X509Certificate with Org.BouncyCastle.Crypto.AsymmetricKeyParameter (private key) implementation from Bouncy Castle could be used.

    Lastly, GemBox.Pdf abstracts a digital ID with a PdfDigitalId class to enable usage of signers for which private key parameters cannot be exported into .NET or Bouncy Castle implementation. These are, for example, Hardware Security Module (HSM), USB token, smart card or a web service and their functionality is called when overriding GemBox.Pdf.Security.PdfDigitalId.SignHash(System.Byte[], GemBox.Pdf.Security.PdfHashAlgorithm, GemBox.Pdf.Security.PdfRSASignaturePadding) method.

    Constructors

    PdfDigitalId(Object)

    Initializes a new instance of the PdfDigitalId class from the specified source.

    The digital ID source is either an instance of a System.Security.Cryptography.X509Certificates.X509Certificate2 with a private key or an instance of a System.Security.Cryptography.CspParameters.

    • C#
    • VB.NET
    public PdfDigitalId(object source)
    Public Sub New(source As Object)
    Parameters
    source
    System.Object

    The digital ID source that is either an instance of a System.Security.Cryptography.X509Certificates.X509Certificate2 with a private key or an instance of a System.Security.Cryptography.CspParameters.

    Exceptions
    System.ArgumentException

    The source parameter is not an instance of a System.Security.Cryptography.X509Certificates.X509Certificate2 or a System.Security.Cryptography.CspParameters.

    System.InvalidOperationException

    Digital ID doesn't have a private key.

    PdfDigitalId(String, String)

    Initializes a new instance of the PdfDigitalId class from a file with the specified file name and the password protecting the private key.

    The most common format for such files is a PKCS#12 file, which uses .pfx or .p12 file extension and is a password protected storage container for digital IDs containing the public key (Certificate) and the associated private key.

    • C#
    • VB.NET
    public PdfDigitalId(string fileName, string password)
    Public Sub New(fileName As String, password As String)
    Parameters
    fileName
    System.String

    The name of a digital ID file that contains the public key (Certificate) and the associated private key.

    password
    System.String

    The password protecting the private key.

    Exceptions
    System.ArgumentNullException

    fileName is null.

    System.InvalidOperationException

    Digital ID doesn't have a private key.

    Properties

    Certificate

    Gets or sets the certificate.

    • C#
    • VB.NET
    public PdfCertificate Certificate { get; set; }
    Public Property Certificate As PdfCertificate
    Property Value
    PdfCertificate

    The certificate.

    Exceptions
    System.InvalidOperationException

    The Certificate is already set.

    System.ArgumentNullException

    Value is null.

    Methods

    ToString()

    Returns a System.String that represents this PdfDigitalId instance.

    • C#
    • VB.NET
    public override string ToString()
    Public Overrides Function ToString As String
    Returns
    System.String

    A System.String that represents this PdfDigitalId instance.

    Overrides
    System.Object.ToString()
    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).

    Examples

    External digital signature example
    Digital signature examples
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.