PemEncoding.TryWriteUtf8 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.
Tries to write the provided data and label as PEM-encoded data into a provided buffer.
public:
static bool TryWriteUtf8(ReadOnlySpan<System::Byte> utf8Label, ReadOnlySpan<System::Byte> data, Span<System::Byte> destination, [Runtime::InteropServices::Out] int % bytesWritten);
public static bool TryWriteUtf8(ReadOnlySpan<byte> utf8Label, ReadOnlySpan<byte> data, Span<byte> destination, out int bytesWritten);
static member TryWriteUtf8 : ReadOnlySpan<byte> * ReadOnlySpan<byte> * Span<byte> * int -> bool
Public Shared Function TryWriteUtf8 (utf8Label As ReadOnlySpan(Of Byte), data As ReadOnlySpan(Of Byte), destination As Span(Of Byte), ByRef bytesWritten As Integer) As Boolean
Parameters
- utf8Label
- ReadOnlySpan<Byte>
The label to write.
- data
- ReadOnlySpan<Byte>
The data to write.
- bytesWritten
- Int32
When this method returns, this parameter contains the number of UTF-8 encoded bytes written to destination.
Returns
true if destination is large enough to contain the PEM-encoded text, otherwise false.
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 IETF RFC 7468. Unix-style line endings are used for line breaks.