Class CertificateInfo
Represents the block of information about an X.509 certificate.
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 |
---|---|---|
Byte[] | rawData | Serialized to bytes certificate (raw data from the .CER and .PFX files are also supported). |
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 |
---|---|---|
X509Certificate2 | certificate | X.509 certificate used to initialize new instance. |
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 |
---|---|
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 |
---|---|
Boolean |
Issuer
Gets or sets certificate's Issuer name.
Declaration
public string Issuer { get; set; }
Property Value
Type | Description |
---|---|
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 |
---|---|
String |
SerialNumber
Gets or sets certificate's serial number (only unique for specific issuer).
Declaration
public string SerialNumber { get; set; }
Property Value
Type | Description |
---|---|
String |
Subject
Gets or sets certificate's Subject name.
Declaration
public string Subject { get; set; }
Property Value
Type | Description |
---|---|
String |
Thumbprint
Gets or sets certificate's thumbprint.
Declaration
public string Thumbprint { get; set; }
Property Value
Type | Description |
---|---|
String |
ValidFrom
Gets or sets the date when certificate becomes valid.
Declaration
public DateTime ValidFrom { get; set; }
Property Value
Type | Description |
---|---|
DateTime |
ValidTo
Gets or sets certificate's expiration date.
Declaration
public DateTime ValidTo { get; set; }
Property Value
Type | Description |
---|---|
DateTime |
Methods
FromHexToBase64(String)
Converts provided hexadecimal string to Base64 encoded string. Method is used to convert thumbprint value found in X509Certificate object to value provided in thumbprint claim.
Declaration
public static string FromHexToBase64(string value)
Parameters
Type | Name | Description |
---|---|---|
String | value | Hexadecimal string that needs to be converted. |
Returns
Type | Description |
---|---|
String | Base64 encoded string that contains the same binary data as provided hexadecimal string. |
OpenCertificate(Byte[], String)
Creates a new instance of X509Certificate2 from the provided serialized X.509 certificate.
Declaration
public static X509Certificate2 OpenCertificate(byte[] data, string password)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | data | Serialized to bytes certificate (raw data from the .CER and .PFX files are also supported). |
String | password | Password used to decrypt the certificate. |
Returns
Type | Description |
---|---|
X509Certificate2 | Deserialized X.509 certificate. |
ToString()
Returns string presentation of the object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
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 |
---|---|---|
X509Certificate | certificate | Certificate to be recorded. |
Returns
Type | Description |
---|---|
String | Base64-encoded certificate in the standard .CER file format. |