AsnReader.TryReadPrimitiveOctetString Method

Definition

Attempts to read the next value as an OCTET STRING with a specified tag, returning the contents as a ReadOnlyMemory<T> over the original data.

public bool TryReadPrimitiveOctetString (out ReadOnlyMemory<byte> contents, System.Formats.Asn1.Asn1Tag? expectedTag = default);
member this.TryReadPrimitiveOctetString : ReadOnlyMemory * Nullable<System.Formats.Asn1.Asn1Tag> -> bool
Public Function TryReadPrimitiveOctetString (ByRef contents As ReadOnlyMemory(Of Byte), Optional expectedTag As Nullable(Of Asn1Tag) = Nothing) As Boolean

Parameters

contents
ReadOnlyMemory<Byte>

On success, receives a ReadOnlyMemory<T> over the original data corresponding to the value of the OCTET STRING.

expectedTag
Nullable<Asn1Tag>

The tag to check for before reading.

Returns

true and advances the reader if the OCTET STRING value had a primitive encoding, false and does not advance the reader if it had a constructed encoding.

Exceptions

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 correct for the method.

Applies to