X509Certificate Class

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Provides methods that help you use X.509 version 3 certificates.

Inheritance Hierarchy

System..::.Object
System.Security.Cryptography.X509Certificates..::.X509Certificate

Namespace: System.Security.Cryptography.X509Certificates
Assembly: mscorlib (in mscorlib.dll)

Syntax

Public Class X509Certificate
public class X509Certificate

The X509Certificate type exposes the following members.

Constructors

Name Description
X509Certificate()()() Initializes a new instance of the X509Certificate class.
X509Certificate(array<Byte>[]()[]) Initializes a new instance of the X509Certificate class defined from a sequence of bytes representing an X.509 version 3 certificate.
X509Certificate(IntPtr) Security Critical. Initializes a new instance of the X509Certificate class using a handle to an unmanaged PCCERT_CONTEXT structure.
X509Certificate(String) Security Critical. Initializes a new instance of the X509Certificate class using a using a certificate file name.
X509Certificate(X509Certificate) Initializes a new instance of the X509Certificate class using another X509Certificate class.
X509Certificate(array<Byte>[]()[], String) Initializes a new instance of the X509Certificate class using a byte array and a password.
X509Certificate(String, String) Security Critical. Initializes a new instance of the X509Certificate class by using a certificate file name and a password to access the certificate.
X509Certificate(array<Byte>[]()[], String, X509KeyStorageFlags) Initializes a new instance of the X509Certificate class using a byte array, a password, and a key storage flag.
X509Certificate(String, String, X509KeyStorageFlags) Security Critical. Initializes a new instance of the X509Certificate class using a certificate file name, a password used to access the certificate, and a key storage flag.

Top

Properties

Name Description
Handle Gets a handle to a Microsoft Cryptographic API certificate context described by an unmanaged PCCERT_CONTEXT structure.
Issuer Gets the name of the certificate authority that issued the X.509 version 3 certificate.
Subject Gets the subject distinguished name from the certificate.

Top

Methods

Name Description
CreateFromCertFile Security Critical. Creates an X.509 version 3 certificate from the specified certification file.
CreateHexString Infrastructure. Creates a hexadecimal string from the specified byte array.
Equals(Object) Compares two X509Certificate objects for equality. (Overrides Object..::.Equals(Object).)
Equals(X509Certificate) Compares two X509Certificate objects for equality.
Export(X509ContentType) Exports the current X509Certificate object to a byte array in a format described by one of the X509ContentType values.
Export(X509ContentType, String) Exports the current X509Certificate object to a byte array in a format described by one of the X509ContentType values, and using the specified password.
Finalize Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
GetCertHash Returns the hash value for the X.509 version 3 certificate as an array of bytes.
GetCertHashString Returns the hash value for the X.509 version 3 certificate as a hexadecimal string.
GetEffectiveDateString Returns the effective date of this X.509 version 3 certificate.
GetExpirationDateString Returns the expiration date of this X.509 version 3 certificate.
GetFormat Returns the name of the format of this X.509 version 3 certificate.
GetHashCode Returns the hash code for the X.509 version 3 certificate as an integer. (Overrides Object..::.GetHashCode()()().)
GetKeyAlgorithm Returns the key algorithm information for this X.509 version 3 certificate.
GetKeyAlgorithmParameters Returns the key algorithm parameters for the X.509 version 3 certificate.
GetKeyAlgorithmParametersString Returns the key algorithm parameters for the X.509 version 3 certificate.
GetPublicKey Returns the public key for the X.509 version 3 certificate.
GetPublicKeyString Returns the public key for the X.509 version 3 certificate.
GetRawCertData Returns the raw data for the entire X.509 version 3 certificate.
GetRawCertDataString Returns the raw data for the entire X.509 version 3 certificate.
GetSerialNumber Returns the serial number of the X.509 version 3 certificate.
GetSerialNumberString Returns the serial number of the X.509 version 3 certificate.
GetType Gets the Type of the current instance. (Inherited from Object.)
Import(array<Byte>[]()[]) Populates the X509Certificate object with data from a byte array.
Import(String) Security Critical. Populates the X509Certificate object with information from a certificate file.
Import(array<Byte>[]()[], String, X509KeyStorageFlags) Populates the X509Certificate object using data from a byte array, a password, and flags for determining how the private key is imported.
Import(String, String, X509KeyStorageFlags) Security Critical. Populates the X509Certificate object with information from a certificate file, a password, and a X509KeyStorageFlags value.
MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
ToString()()() Returns a string representation of the current X509Certificate object. (Overrides Object..::.ToString()()().)
ToString(Boolean) Returns a string representation of the current X509Certificate object, with extra information, if specified.

Top

Remarks

ASN.1 DER is the only certificate format supported by this class.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System.Security.Cryptography.X509Certificates Namespace