X509Certificate2Collection.ExportCertificatePems Method

Definition

Exports the public X.509 certificates, encoded as PEM.

C#
public string ExportCertificatePems();

Returns

The PEM encoding of the certificates.

Exceptions

A certificate is corrupt, in an invalid state, or could not be exported to PEM.

The combined size of encoding all certificates exceeds Int32.MaxValue.

Remarks

A PEM-encoded X.509 certificate collection will contain certificates where each certificate begins with -----BEGIN CERTIFICATE----- and ends with -----END CERTIFICATE-----, with the base64 encoded DER contents of the certificate between the PEM boundaries. Each certificate is separated by a single line-feed character.

          Certificates are encoded according to the IETF RFC 7468 "strict" encoding rules.

Applies to

Product Versions
.NET 7, 8, 9, 10