Class X509Certificate2
Represents an X.509 certificate.
Inherited Members
Namespace: System.Security.Cryptography.X509Certificates
Assembly: System.Net.dll
Syntax
public class X509Certificate2 : X509Certificate
Constructors
X509Certificate2()
Initializes a new instance of the X509Certificate2 class.
Declaration
public X509Certificate2()
X509Certificate2(byte[], byte[], string)
Initializes a new instance of the X509Certificate2 class using a string with the content of an X.509 public certificate, the private key and a password used to access the certificate.
Declaration
public X509Certificate2(byte[] rawData, byte[] key, string password)
Parameters
Type | Name | Description |
---|---|---|
byte[] | rawData | A byte array containing data from an X.509 certificate. |
byte[] | key | A byte array containing a PEM private key. |
string | password | The password required to decrypt the private key. null if the |
Remarks
This methods is exclusive of nanoFramework. There is no equivalent in .NET framework.
X509Certificate2(byte[], string, string)
Initializes a new instance of the X509Certificate2 class using a string with the content of an X.509 public certificate, the private key and a password used to access the certificate.
Declaration
public X509Certificate2(byte[] rawData, string key, string password)
Parameters
Type | Name | Description |
---|---|---|
byte[] | rawData | A byte array containing data from an X.509 certificate. |
string | key | A string containing a private key in PEM or DER format. |
string | password | The password required to decrypt the private key. Set to null if the |
Remarks
This methods is exclusive of .NET nanoFramework. There is no equivalent in .NET framework.
X509Certificate2(byte[])
Initializes a new instance of the X509Certificate2 class using information from a byte array.
Declaration
public X509Certificate2(byte[] rawData)
Parameters
Type | Name | Description |
---|---|---|
byte[] | rawData | A byte array containing data from an X.509 certificate. |
X509Certificate2(string, string, string)
Initializes a new instance of the X509Certificate2 class using a string with the content of an X.509 public certificate, the private key and a password used to access the private key.
Declaration
public X509Certificate2(string rawData, string key, string password)
Parameters
Type | Name | Description |
---|---|---|
string | rawData | A string containing a X.509 certificate. |
string | key | A string containing a private key in PEM or DER format. |
string | password | The password required to decrypt the private key. Set to null if the |
Remarks
This methods is exclusive of .NET nanoFramework. There is no equivalent in .NET framework.
X509Certificate2(string)
Initializes a new instance of the X509Certificate2 class using a string with the content of an X.509 certificate.
Declaration
public X509Certificate2(string certificate)
Parameters
Type | Name | Description |
---|---|---|
string | certificate | A string containing a X.509 certificate. |
Remarks
This methods is exclusive of .NET nanoFramework. The equivalent .NET constructor accepts a file name as the parameter.
Properties
HasPrivateKey
Gets a value that indicates whether an X509Certificate2 object contains a private key.
Declaration
public bool HasPrivateKey { get; }
Property Value
Type | Description |
---|---|
bool | true if the X509Certificate2 object contains a private key; otherwise, false. |
NotAfter
Gets the date (in UTC time) after which a certificate is no longer valid.
Declaration
public DateTime NotAfter { get; }
Property Value
Type | Description |
---|---|
DateTime | A DateTime object that represents the expiration date for the certificate. |
NotBefore
Gets the date (in UTC time) on which a certificate becomes valid.
Declaration
public DateTime NotBefore { get; }
Property Value
Type | Description |
---|---|
DateTime | A DateTime object that represents the effective date of the certificate. |
PrivateKey
Gets the private key, null if there isn't a private key.
Declaration
public byte[] PrivateKey { get; }
Property Value
Type | Description |
---|---|
byte[] |
Remarks
This will give you access directly to the raw decoded byte array of the private key
PublicKey
Gets the public key.
Declaration
public byte[] PublicKey { get; }
Property Value
Type | Description |
---|---|
byte[] |
Remarks
This will give you access directly to the raw decoded byte array of the public key.
RawData
Gets the raw data of a certificate.
Declaration
public byte[] RawData { get; }
Property Value
Type | Description |
---|---|
byte[] | The raw data of the certificate as a byte array. |