Search Results for

    Show / Hide Table of Contents

    Class X509Certificate2

    Represents an X.509 certificate.

    Inheritance
    object
    X509Certificate
    X509Certificate2
    Inherited Members
    X509Certificate._issuer
    X509Certificate._subject
    X509Certificate._effectiveDate
    X509Certificate._expirationDate
    X509Certificate._handle
    X509Certificate._sessionHandle
    X509Certificate.GetEffectiveDate()
    X509Certificate.GetExpirationDate()
    X509Certificate.GetRawCertData()
    X509Certificate.Issuer
    X509Certificate.Subject
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    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 rawData or key are not encrypted.

    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 rawData or key are not encrypted and do not require a password.

    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 rawData or key are not encrypted and do not require a password.

    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.

    Extension Methods

    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    In This Article
    Back to top Copyright © 2023 nanoFramework Contributors
    Generated by DocFX