Certificate 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.
- Inheritance:
- System.ObjectCertificate
Remarks
GemBox.Document 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.Document abstracts a certificate with a Certificate 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
Certificate(Object)
Initializes a new instance of the Certificate 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.
Certificate(String)
Initializes a new instance of the Certificate 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(Certificate)
Determines whether the specified Certificate is equal to this Certificate instance.
public bool Equals(Certificate other)
Public Function Equals(other As Certificate) As Boolean
Parameters
other
- Certificate
The Certificate to compare with this Certificate instance.
Returns
- System.Boolean
true if the specified Certificate is equal to this Certificate instance; otherwise, false.
Equals(Object)
Determines whether the specified System.Object is equal to this Certificate 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 Certificate instance.
Returns
- System.Boolean
true if the specified System.Object is equal to this Certificate instance; otherwise, false.
Overrides
GetHashCode()
Returns a hash code for this Certificate instance.
Returns
- System.Int32
A hash code for this Certificate instance, suitable for use in hashing algorithms and data structures like a hash table.
Overrides
GetRawData()
Gets the copy of raw data of a Certificate.
Returns
- System.Byte[]
The copy of raw data of the Certificate as a byte array.
ToString()
Returns a System.String that represents this Certificate instance.
Returns
- System.String
A System.String that represents this Certificate 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).