X509Certificate2 Constructor (Byte[])

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Initializes a new instance of the X509Certificate2 class using information from a byte array.

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

public X509Certificate2(
	byte[] rawData
)

Parameters

rawData
Type: System.Byte[]

A byte array containing data from an X.509 certificate.

Exception Condition
CryptographicException

An error with the certificate occurs. For example:

  • The certificate file does not exist.

  • The certificate is invalid.

  • The certificate's password is incorrect.

This constructor creates a new X509Certificate2 object using certificate information from a byte array. The byte array can be binary (DER) encoded or Base64-encoded X.509 data. The byte array can also be a PKCS7 (Authenticode) signed file; the signer certificate is used to create the object.

If you create an X509Certificate2 certificate by specifying a PKCS7 signed file store for rawData, the X509Certificate2 is created for the certificate that signed the store rather than for any of the certificates within the store.

.NET Framework
Available since 2.0
Return to top
Show: