Compartilhar via


AsnReader Class

Definition

A stateful, forward-only reader for BER-, CER-, or DER-encoded ASN.1 data.

public ref class AsnReader
public class AsnReader
type AsnReader = class
Public Class AsnReader
Inheritance
AsnReader

Constructors

AsnReader(ReadOnlyMemory<Byte>, AsnEncodingRules, AsnReaderOptions)

Construct an AsnReader over data with a given ruleset.

Properties

HasData

Gets an indication of whether the reader has remaining data available to process.

RuleSet

Gets the encoding rules in use by this reader.

Methods

Clone()

Clones the current reader.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
PeekContentBytes()

Get a ReadOnlyMemory<T> view of the content octets (bytes) of the next encoded value without advancing the reader.

PeekEncodedValue()

Get a ReadOnlyMemory<T> view of the next encoded value without advancing the reader. For indefinite length encodings this includes the End of Contents marker.

PeekTag()

Read the encoded tag at the next data position, without advancing the reader.

ReadBitString(Int32, Nullable<Asn1Tag>)

Reads the next value as a BIT STRING with a specified tag, returning the value in a byte array.

ReadBoolean(Nullable<Asn1Tag>)

Reads the next value as a Boolean with a specified tag.

ReadCharacterString(UniversalTagNumber, Nullable<Asn1Tag>)

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

ReadEncodedValue()

Get a ReadOnlyMemory<T> view of the next encoded value, and advance the reader past it. For an indefinite length encoding this includes the End of Contents marker.

ReadEnumeratedBytes(Nullable<Asn1Tag>)

Reads the next value as a Enumerated with a specified tag, returning the contents as a ReadOnlyMemory<T> over the original data.

ReadEnumeratedValue(Type, Nullable<Asn1Tag>)

Reads the next value as an Enumerated with a specified tag, converting it to the non-[FlagsAttribute] enum specified by enumType.

ReadEnumeratedValue<TEnum>(Nullable<Asn1Tag>)

Reads the next value as an Enumerated with a specified tag, converting it to the non-[FlagsAttribute] enum specified by TEnum.

ReadGeneralizedTime(Nullable<Asn1Tag>)

Reads the next value as a GeneralizedTime with a specified tag.

ReadInteger(Nullable<Asn1Tag>)

Reads the next value as an Integer with a specified tag.

ReadIntegerBytes(Nullable<Asn1Tag>)

Reads the next value as a Integer with a specified tag, returning the contents as a ReadOnlyMemory<T> over the original data.

ReadNamedBitList(Nullable<Asn1Tag>)

Reads the next value as a NamedBitList with a specified tag.

ReadNamedBitListValue(Type, Nullable<Asn1Tag>)

Reads the next value as a NamedBitList with a specified tag, converting it to the [FlagsAttribute] enum specified by flagsEnumType.

ReadNamedBitListValue<TFlagsEnum>(Nullable<Asn1Tag>)

Reads the next value as a NamedBitList with a specified tag, converting it to the [FlagsAttribute] enum specified by TFlagsEnum.

ReadNull(Nullable<Asn1Tag>)

Reads the next value as a NULL with a specified tag.

ReadObjectIdentifier(Nullable<Asn1Tag>)

Reads the next value as an OBJECT IDENTIFIER with a specified tag, returning the value in a dotted decimal format string.

ReadOctetString(Nullable<Asn1Tag>)

Reads the next value as an OCTET STRING with tag UNIVERSAL 4, returning the value in a byte array.

ReadSequence(Nullable<Asn1Tag>)

Reads the next value as a SEQUENCE or SEQUENCE-OF with the specified tag and returns the result as a new reader positioned at the first value in the sequence (or with HasData == false).

ReadSetOf(Boolean, Nullable<Asn1Tag>)

Reads the next value as a SET-OF with the specified tag and returns the result as a new reader positioned at the first value in the set-of (or with HasData == false).

ReadSetOf(Nullable<Asn1Tag>)

Reads the next value as a SET-OF with the specified tag and returns the result as a new reader positioned at the first value in the set-of (or with HasData == false), using the SkipSetSortOrderVerification value from the constructor (default false).

ReadUtcTime(Int32, Nullable<Asn1Tag>)

Reads the next value as a UTCTime with a specified tag.

ReadUtcTime(Nullable<Asn1Tag>)

Reads the next value as a UTCTime with a specified tag using the UtcTimeTwoDigitYearMax value from options passed to the constructor (with a default of 2049).

ThrowIfNotEmpty()

Throws a standardized AsnContentException if the reader has remaining data, performs no function if HasData returns false.

ToString()

Returns a string that represents the current object.

(Inherited from Object)
TryReadBitString(Span<Byte>, Int32, Int32, Nullable<Asn1Tag>)

Reads the next value as a BIT STRING with a specified tag, copying the value into a provided destination buffer.

TryReadCharacterString(Span<Char>, UniversalTagNumber, Int32, Nullable<Asn1Tag>)

Reads the next value as character string with the specified tag and encoding type, copying the decoded value into a provided destination buffer.

TryReadCharacterStringBytes(Span<Byte>, Asn1Tag, Int32)

Reads the next value as character string with the specified tag, copying the unprocessed bytes into a provided destination buffer.

TryReadInt32(Int32, Nullable<Asn1Tag>)

Attempts to read the next value as an Integer with a specified tag, as a signed 32-bit value.

TryReadInt64(Int64, Nullable<Asn1Tag>)

Attempts to read the next value as an Integer with a specified tag, as a signed 64-bit value.

TryReadOctetString(Span<Byte>, Int32, Nullable<Asn1Tag>)

Reads the next value as an OCTET STRING with a specified tag, copying the value into a provided destination buffer.

TryReadPrimitiveBitString(Int32, ReadOnlyMemory<Byte>, Nullable<Asn1Tag>)

Reads the next value as a BIT STRING with a specified tag, returning the contents as a ReadOnlyMemory<T> over the original data.

TryReadPrimitiveCharacterStringBytes(Asn1Tag, ReadOnlyMemory<Byte>)

Reads the next value as a character with a specified tag, returning the contents as an unprocessed ReadOnlyMemory<T> over the original data.

TryReadPrimitiveOctetString(ReadOnlyMemory<Byte>, Nullable<Asn1Tag>)

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.

TryReadUInt32(UInt32, Nullable<Asn1Tag>)

Attempts to read the next value as an Integer with a specified tag, as an unsigned 32-bit value.

TryReadUInt64(UInt64, Nullable<Asn1Tag>)

Attempts to read the next value as an Integer with a specified tag, as an unsigned 64-bit value.

Applies to