PemEncoding.WriteUtf8 Method

Definition

Creates an encoded PEM with the given label and data.

public:
 static cli::array <System::Byte> ^ WriteUtf8(ReadOnlySpan<System::Byte> utf8Label, ReadOnlySpan<System::Byte> data);
public static byte[] WriteUtf8(ReadOnlySpan<byte> utf8Label, ReadOnlySpan<byte> data);
static member WriteUtf8 : ReadOnlySpan<byte> * ReadOnlySpan<byte> -> byte[]
Public Shared Function WriteUtf8 (utf8Label As ReadOnlySpan(Of Byte), data As ReadOnlySpan(Of Byte)) As Byte()

Parameters

utf8Label
ReadOnlySpan<Byte>

The label to encode.

data
ReadOnlySpan<Byte>

The data to encode.

Returns

Byte[]

An array containing the bytes representing the UTF-8 encoding of the PEM.

Exceptions

utf8Label exceeds the maximum possible label length.

-or-

data exceeds the maximum possible encoded data length.

The resulting PEM-encoded text is larger than MaxValue.

-or-

utf8Label contains invalid characters or is malformed UTF-8.

Remarks

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

Applies to