AsnDecoder.ReadCharacterString Method

Definition

Reads the next value as character string with the specified tag and encoding type, returning the decoded string.

public static string ReadCharacterString (ReadOnlySpan<byte> source, System.Formats.Asn1.AsnEncodingRules ruleSet, System.Formats.Asn1.UniversalTagNumber encodingType, out int bytesConsumed, System.Formats.Asn1.Asn1Tag? expectedTag = default);
static member ReadCharacterString : ReadOnlySpan<byte> * System.Formats.Asn1.AsnEncodingRules * System.Formats.Asn1.UniversalTagNumber * int * Nullable<System.Formats.Asn1.Asn1Tag> -> string
Public Shared Function ReadCharacterString (source As ReadOnlySpan(Of Byte), ruleSet As AsnEncodingRules, encodingType As UniversalTagNumber, ByRef bytesConsumed As Integer, Optional expectedTag As Nullable(Of Asn1Tag) = Nothing) As String

Parameters

source
ReadOnlySpan<Byte>

The buffer containing encoded data.

ruleSet
AsnEncodingRules

The encoding constraints to use when interpreting the data.

encodingType
UniversalTagNumber

One of the enumeration values which represents the value type to process.

bytesConsumed
Int32

When this method returns, the total number of bytes for the encoded value. This parameter is treated as uninitialized.

expectedTag
Nullable<Asn1Tag>

The tag to check for before reading, or null for the universal tag that is appropriate to the requested encoding type.

Returns

The decoded value.

Exceptions

ruleSet is not defined.

-or-

encodingType is not a known character string type.

The next value does not have the correct tag.

-or-

The length encoding is not valid under the current encoding rules.

-or-

The contents are not valid under the current encoding rules.

-or-

The string did not successfully decode.

expectedTag.TagClass is Universal, but expectedTag.TagValue is not the same as encodingType.

Applies to