Class CertificateInfo
Represents the block of information about an X.509 certificate.
Inheritance
Inherited Members
Namespace: Nevatech.Vsb.Repository.Description
Assembly: Nevatech.Vsb.Repository.dll
Syntax
public class CertificateInfo
Constructors
CertificateInfo()
Initializes empty instance.
Declaration
public CertificateInfo()
CertificateInfo(Byte[], String)
Initializes and populates new instance from the provided serialized X.509 certificate.
Declaration
public CertificateInfo(byte[] rawData, string password)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | rawData | Serialized to bytes certificate (raw data from the .CER and .PFX files are also supported). |
System.String | password | Password used to decrypt the certificate. |
CertificateInfo(X509Certificate2, Boolean)
Initializes and populates new instance from the specified X.509 certificate.
Declaration
public CertificateInfo(X509Certificate2 certificate, bool disposeCertificate = false)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Cryptography.X509Certificates.X509Certificate2 | certificate | X.509 certificate used to initialize new instance. |
System.Boolean | disposeCertificate | Flag indicating that provided certificate should be disposed after extracting information from it. |
Fields
RawData
Gets or sets byte array containing data from X.509 certificate.
Declaration
public byte[] RawData
Field Value
Type | Description |
---|---|
System.Byte[] |
Properties
ContentType
Gets or sets the content type of RawData property.
Declaration
public CertificateContentType ContentType { get; set; }
Property Value
Type | Description |
---|---|
CertificateContentType |
HasPrivateKey
Gets or sets flag indicating that certificate has private key.
Declaration
public bool HasPrivateKey { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Issuer
Gets or sets certificate's Issuer name.
Declaration
public string Issuer { get; set; }
Property Value
Type | Description |
---|---|
System.String |
PublicData
Gets or sets certificate without private key in the standard Base64-encoded .CER file format.
Declaration
public string PublicData { get; set; }
Property Value
Type | Description |
---|---|
System.String |
SerialNumber
Gets or sets certificate's serial number (only unique for specific issuer).
Declaration
public string SerialNumber { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Subject
Gets or sets certificate's Subject name.
Declaration
public string Subject { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Thumbprint
Gets or sets certificate's thumbprint.
Declaration
public string Thumbprint { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ValidFrom
Gets or sets the date when certificate becomes valid.
Declaration
public DateTime ValidFrom { get; set; }
Property Value
Type | Description |
---|---|
System.DateTime |
ValidTo
Gets or sets certificate's expiration date.
Declaration
public DateTime ValidTo { get; set; }
Property Value
Type | Description |
---|---|
System.DateTime |
Methods
FromHexToBase64(String)
Converts provided hexadecimal string to Base64 encoded string. Method is used to convert thumbprint value found in System.Security.Cryptography.X509Certificates.X509Certificate object to value provided in thumbprint claim.
Declaration
public static string FromHexToBase64(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | Hexadecimal string that needs to be converted. |
Returns
Type | Description |
---|---|
System.String | Base64 encoded string that contains the same binary data as provided hexadecimal string. |
OpenCertificate(Byte[], String)
Creates a new instance of System.Security.Cryptography.X509Certificates.X509Certificate2 from the provided serialized X.509 certificate.
Declaration
public static X509Certificate2 OpenCertificate(byte[] data, string password)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | Serialized to bytes certificate (raw data from the .CER and .PFX files are also supported). |
System.String | password | Password used to decrypt the certificate. |
Returns
Type | Description |
---|---|
System.Security.Cryptography.X509Certificates.X509Certificate2 | Deserialized X.509 certificate. |
ToString()
Returns string presentation of the object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | X.509 certificate friendly name. |
Overrides
WriteAsBase64Certificate(X509Certificate)
Returns Base64-encoded certificate in the standard .CER file format.
Declaration
public static string WriteAsBase64Certificate(X509Certificate certificate)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Cryptography.X509Certificates.X509Certificate | certificate | Certificate to be recorded. |
Returns
Type | Description |
---|---|
System.String | Base64-encoded certificate in the standard .CER file format. |