Share via


AsnDecoder.TryReadPrimitiveCharacterStringBytes Method

Definition

Attempts to get an unprocessed character string value from source with a specified tag under the specified encoding rules, if the value is contained in a single (primitive) encoding.

public:
 static bool TryReadPrimitiveCharacterStringBytes(ReadOnlySpan<System::Byte> source, System::Formats::Asn1::AsnEncodingRules ruleSet, System::Formats::Asn1::Asn1Tag expectedTag, [Runtime::InteropServices::Out] ReadOnlySpan<System::Byte> % value, [Runtime::InteropServices::Out] int % bytesConsumed);
public static bool TryReadPrimitiveCharacterStringBytes (ReadOnlySpan<byte> source, System.Formats.Asn1.AsnEncodingRules ruleSet, System.Formats.Asn1.Asn1Tag expectedTag, out ReadOnlySpan<byte> value, out int bytesConsumed);
static member TryReadPrimitiveCharacterStringBytes : ReadOnlySpan<byte> * System.Formats.Asn1.AsnEncodingRules * System.Formats.Asn1.Asn1Tag * ReadOnlySpan * int -> bool
Public Shared Function TryReadPrimitiveCharacterStringBytes (source As ReadOnlySpan(Of Byte), ruleSet As AsnEncodingRules, expectedTag As Asn1Tag, ByRef value As ReadOnlySpan(Of Byte), ByRef bytesConsumed As Integer) As Boolean

Parameters

source
ReadOnlySpan<Byte>

The buffer containing encoded data.

ruleSet
AsnEncodingRules

The encoding constraints to use when interpreting the data.

expectedTag
Asn1Tag

The tag to check for before reading.

value
ReadOnlySpan<Byte>

On success, receives a slice of the input buffer that corresponds to the value of the Bit String. This parameter is treated as uninitialized.

bytesConsumed
Int32

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

Returns

true if the character string value has a primitive encoding; otherwise, false.

Exceptions

ruleSet is not defined.

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.

expectedTag.TagClass is Universal, but expectedTag.TagValue is not a character string tag type.

Remarks

This method does not determine if the string used only characters defined by the encoding.

Applies to

See also