X509Certificate2.TryExportCertificatePem(Span<Char>, Int32) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Attempts to export the public X.509 certificate, encoded as PEM.
public:
bool TryExportCertificatePem(Span<char> destination, [Runtime::InteropServices::Out] int % charsWritten);
public bool TryExportCertificatePem (Span<char> destination, out int charsWritten);
member this.TryExportCertificatePem : Span<char> * int -> bool
Public Function TryExportCertificatePem (destination As Span(Of Char), ByRef charsWritten As Integer) As Boolean
Parameters
- 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 PEM; otherwise, false
.
Exceptions
The certificate is corrupt, in an invalid state, or could not be exported to PEM.
Remarks
A PEM-encoded X.509 certificate will begin with -----BEGIN CERTIFICATE-----
and end with -----END CERTIFICATE-----
, with the base64 encoded DER
contents of the certificate between the PEM boundaries.
The certificate is encoded according to the IETF RFC 7468 "strict" encoding rules.