Muokkaa

Jaa


PemEncoding.TryWrite Method

Definition

Tries to write the provided data and label as PEM-encoded data into a provided buffer.

public:
 static bool TryWrite(ReadOnlySpan<char> label, ReadOnlySpan<System::Byte> data, Span<char> destination, [Runtime::InteropServices::Out] int % charsWritten);
public static bool TryWrite (ReadOnlySpan<char> label, ReadOnlySpan<byte> data, Span<char> destination, out int charsWritten);
static member TryWrite : ReadOnlySpan<char> * ReadOnlySpan<byte> * Span<char> * int -> bool
Public Shared Function TryWrite (label As ReadOnlySpan(Of Char), data As ReadOnlySpan(Of Byte), destination As Span(Of Char), ByRef charsWritten As Integer) As Boolean

Parameters

label
ReadOnlySpan<Char>

The label to write.

data
ReadOnlySpan<Byte>

The data to write.

destination
Span<Char>

The buffer to receive the PEM-encoded text.

charsWritten
Int32

When this method returns, this parameter contains the number of characters written to destination. This parameter is treated as uninitialized.

Returns

true if destination is large enough to contain the PEM-encoded text, otherwise false.

Exceptions

label exceeds the maximum possible label length.

-or-

data exceeds the maximum possible encoded data length.

The resulting PEM-encoded text is larger than Int32.MaxValue.

-or-

label contains invalid characters.

Remarks

This method always wraps the base-64 encoded text to 64 characters, per the recommended wrapping of IETF RFC 7468. Unix-style line endings are used for line breaks.

Applies to