Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Security.​Cryptography.​PemEncoding

Assembly: System.Security.Cryptography

Inheritance: object → PemEncoding

Provides methods for reading and writing the IETF RFC 7468 subset of PEM (Privacy-Enhanced Mail) textual encodings. This class cannot be inherited.

Methods

public static PemFields
Find​(ReadOnlySpan<​char> pemData)
Finds the first PEM-encoded data.
Returns A value that specifies the location, label, and data location of the encoded data.
pemData The text containing the PEM-encoded data.
public static PemFields
FindUtf8​(ReadOnlySpan<​byte> pemData)
Finds the first PEM-encoded data.
Returns <para>A value that specifies the location, label, and data location of the encoded data.</para>
pemData The text containing the PEM-encoded data.
public static int
GetEncodedSize​(int labelLength, int dataLength)
Determines the length of a PEM-encoded value, in characters, given the length of a label and binary data.
Returns The number of characters in the encoded PEM.
labelLength The length of the label, in characters.
dataLength The length of the data, in bytes.
public static bool
TryFind​(ReadOnlySpan<​char> pemData, PemFields& fields)
public static bool
TryFindUtf8​(ReadOnlySpan<​byte> pemData, PemFields& fields)
public static bool
TryWrite​(ReadOnlySpan<​char> label, ReadOnlySpan<​byte> data, Span<​char> destination, Int32& charsWritten)
public static bool
TryWriteUtf8​(ReadOnlySpan<​byte> utf8Label, ReadOnlySpan<​byte> data, Span<​byte> destination, Int32& bytesWritten)
public static char[]
Write​(ReadOnlySpan<​char> label, ReadOnlySpan<​byte> data)
Creates an encoded PEM with the given label and data.
Returns A character array of the encoded PEM.
label The label to encode.
data The data to encode.
public static string
WriteString​(ReadOnlySpan<​char> label, ReadOnlySpan<​byte> data)
Creates an encoded PEM with the given label and data.
Returns A string of the encoded PEM.
label The label to encode.
data The data to encode.
public static byte[]
WriteUtf8​(ReadOnlySpan<​byte> utf8Label, ReadOnlySpan<​byte> data)
Creates an encoded PEM with the given label and data.
Returns An array containing the bytes representing the UTF-8 encoding of the PEM.
utf8Label The label to encode.
data The data to encode.
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object