X509Certificate2Collection.TryExportCertificatePems Method

Definition

Attempts to export the public X.509 certificates, encoded as PEM.

public:
 bool TryExportCertificatePems(Span<char> destination, [Runtime::InteropServices::Out] int % charsWritten);
public bool TryExportCertificatePems (Span<char> destination, out int charsWritten);
member this.TryExportCertificatePems : Span<char> * int -> bool
Public Function TryExportCertificatePems (destination As Span(Of Char), ByRef charsWritten As Integer) As Boolean

Parameters

destination
Span<Char>

The buffer to receive the PEM encoded certificates.

charsWritten
Int32

When this method returns, the total number of characters written to destination.

Returns

true if destination was large enough to receive the encoded PEMs; otherwise, false.

Exceptions

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

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