X509Certificate2Collection.Export Method

Definition

Exports X.509 certificate information based on content type into a byte array.

Overloads

Export(X509ContentType)

Exports X.509 certificate information into a byte array.

Export(X509ContentType, String)

Exports X.509 certificate information into a byte array using a password.

Export(X509ContentType)

Source:
X509Certificate2Collection.cs
Source:
X509Certificate2Collection.cs
Source:
X509Certificate2Collection.cs

Exports X.509 certificate information into a byte array.

C#
public byte[]? Export(System.Security.Cryptography.X509Certificates.X509ContentType contentType);
C#
public byte[] Export(System.Security.Cryptography.X509Certificates.X509ContentType contentType);

Parameters

contentType
X509ContentType

A supported X509ContentType object.

Returns

Byte[]

X.509 certificate information in a byte array.

Remarks

This method supports content types that do not require a password.

Applies to

.NET 10 i druge verzije
Proizvod Verzije
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.3, 1.4, 1.6, 2.0, 2.1

Export(X509ContentType, String)

Source:
X509Certificate2Collection.cs
Source:
X509Certificate2Collection.cs
Source:
X509Certificate2Collection.cs

Exports X.509 certificate information into a byte array using a password.

C#
public byte[]? Export(System.Security.Cryptography.X509Certificates.X509ContentType contentType, string? password);
C#
public byte[] Export(System.Security.Cryptography.X509Certificates.X509ContentType contentType, string password);

Parameters

contentType
X509ContentType

A supported X509ContentType object.

password
String

A string used to protect the byte array.

Returns

Byte[]

X.509 certificate information in a byte array.

Exceptions

The certificate is unreadable, the content is invalid or, in the case of a certificate requiring a password, the private key could not be exported because the password provided was incorrect.

Remarks

This method supports the following X509ContentType types:

Applies to

.NET 10 i druge verzije
Proizvod Verzije
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.3, 1.4, 1.6, 2.0, 2.1