PdfCertificate Class
Represents an X.509 certificate sent to others so that they can verify your digital signature with a public key contained in the certificate.
public sealed class PdfCertificate : IEquatable<PdfCertificate>
Public NotInheritable Class PdfCertificate
Implements IEquatable(Of PdfCertificate)
- Inheritance:
- System.ObjectPdfCertificate
Implements
Remarks
GemBox.Pdf doesn't use System.Security.Cryptography.X509Certificates.X509Certificate2 class to represent a certificate because System.Security.Cryptography.X509Certificates.X509Certificate2 creates a file that holds the certificate with the public key (in various locations on a hard drive) and on some operating systems and platforms that file is not deleted unless System.Security.Cryptography.X509Certificates.X509Certificate2.Reset method is called. This creation of a file prevents usages of certificates in Medium Trust.
Another reason why GemBox.Pdf abstracts a certificate with a PdfCertificate class instead of using System.Security.Cryptography.X509Certificates.X509Certificate2 directly is to enable different implementations of a certificate. For example, either System.Security.Cryptography.X509Certificates.X509Certificate2 implementation from .NET or Org.BouncyCastle.X509.X509Certificate implementation from Bouncy Castle could be used.
Constructors
PdfCertificate(Object)
Initializes a new instance of the PdfCertificate class from the specified source.
The certificate source is an instance of a System.Security.Cryptography.X509Certificates.X509Certificate2.
Parameters
source
- System.Object
The certificate source that is an instance of a System.Security.Cryptography.X509Certificates.X509Certificate2.
Exceptions
- System.ArgumentException
The source
parameter is not an instance of a System.Security.Cryptography.X509Certificates.X509Certificate2.
PdfCertificate(String)
Initializes a new instance of the PdfCertificate class from a file with the specified file name.
Parameters
fileName
- System.String
The name of a certificate file.
Exceptions
- System.ArgumentNullException
fileName
is null.
Properties
Subject
Gets the subject distinguished name from the certificate.
Property Value
- System.String
The subject distinguished name from the certificate.
SubjectCommonName
Gets the value of a Common Name attribute from Subject's distinguished name.
public string SubjectCommonName { get; }
Public ReadOnly Property SubjectCommonName As String
Property Value
- System.String
The value of a Common Name attribute from Subject's distinguished name.
Methods
Equals(PdfCertificate)
Determines whether the specified PdfCertificate is equal to this PdfCertificate instance.
public bool Equals(PdfCertificate other)
Public Function Equals(other As PdfCertificate) As Boolean
Parameters
other
- PdfCertificate
The PdfCertificate to compare with this PdfCertificate instance.
Returns
- System.Boolean
true if the specified PdfCertificate is equal to this PdfCertificate instance; otherwise, false.
Equals(Object)
Determines whether the specified System.Object is equal to this PdfCertificate instance.
public override bool Equals(object obj)
Public Overrides Function Equals(obj As Object) As Boolean
Parameters
obj
- System.Object
The System.Object to compare with this PdfCertificate instance.
Returns
- System.Boolean
true if the specified System.Object is equal to this PdfCertificate instance; otherwise, false.
Overrides
FromPem(String)
Creates a PdfCertificate from a PEM encoded certificate data.
public static PdfCertificate FromPem(string pem)
Public Shared Function FromPem(pem As String) As PdfCertificate
Parameters
pem
- System.String
The PEM encoded certificate data.
Returns
A PdfCertificate created from the specified PEM encoded certificate data.
GetHashCode()
Returns a hash code for this PdfCertificate instance.
Returns
- System.Int32
A hash code for this PdfCertificate instance, suitable for use in hashing algorithms and data structures like a hash table.
Overrides
GetRawData()
Gets the copy of raw data of a PdfCertificate.
Returns
- System.Byte[]
The copy of raw data of the PdfCertificate as a byte array.
ToString()
Returns a System.String that represents this PdfCertificate instance.
Returns
- System.String
A System.String that represents this PdfCertificate 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).