Leer en inglés

Compartir vía


AsnDecoder Class

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Provides stateless methods for decoding BER-encoded, CER-encoded, and DER-encoded ASN.1 data.

C#
public static class AsnDecoder
Inheritance
AsnDecoder

Methods

DecodeLength(ReadOnlySpan<Byte>, AsnEncodingRules, Int32)

Decodes the data in source as a length value under the specified encoding rules.

ReadBitString(ReadOnlySpan<Byte>, AsnEncodingRules, Int32, Int32, Nullable<Asn1Tag>)

Reads a Bit String value from source with a specified tag under the specified encoding rules, returning the contents in a new array.

ReadBoolean(ReadOnlySpan<Byte>, AsnEncodingRules, Int32, Nullable<Asn1Tag>)

Reads a Boolean value from source with a specified tag under the specified encoding rules.

ReadCharacterString(ReadOnlySpan<Byte>, AsnEncodingRules, UniversalTagNumber, Int32, Nullable<Asn1Tag>)

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

ReadEncodedValue(ReadOnlySpan<Byte>, AsnEncodingRules, Int32, Int32, Int32)

Locates the contents range for the encoded value at the beginning of the source buffer using the specified encoding rules.

ReadEnumeratedBytes(ReadOnlySpan<Byte>, AsnEncodingRules, Int32, Nullable<Asn1Tag>)

Reads an Enumerated value from source with a specified tag under the specified encoding rules, returning the contents as a slice of the buffer.

ReadEnumeratedValue(ReadOnlySpan<Byte>, AsnEncodingRules, Type, Int32, Nullable<Asn1Tag>)

Reads an Enumerated from source with a specified tag under the specified encoding rules, converting it to the non-[FlagsAttribute] enum specified by enumType.

ReadEnumeratedValue<TEnum>(ReadOnlySpan<Byte>, AsnEncodingRules, Int32, Nullable<Asn1Tag>)

Reads an Enumerated from source with a specified tag under the specified encoding rules, converting it to the non-[FlagsAttribute] enum specified by TEnum.

ReadGeneralizedTime(ReadOnlySpan<Byte>, AsnEncodingRules, Int32, Nullable<Asn1Tag>)

Reads a GeneralizedTime value from source with a specified tag under the specified encoding rules.

ReadInteger(ReadOnlySpan<Byte>, AsnEncodingRules, Int32, Nullable<Asn1Tag>)

Reads an Integer value from source with a specified tag under the specified encoding rules.

ReadIntegerBytes(ReadOnlySpan<Byte>, AsnEncodingRules, Int32, Nullable<Asn1Tag>)

Reads an Integer value from source with a specified tag under the specified encoding rules, returning the contents as a slice of the buffer.

ReadNamedBitList(ReadOnlySpan<Byte>, AsnEncodingRules, Int32, Nullable<Asn1Tag>)

Reads a NamedBitList from source with a specified tag under the specified encoding rules.

ReadNamedBitListValue(ReadOnlySpan<Byte>, AsnEncodingRules, Type, Int32, Nullable<Asn1Tag>)

Reads a NamedBitList from source with a specified tag under the specified encoding rules, converting it to the [FlagsAttribute] enum specified by flagsEnumType.

ReadNamedBitListValue<TFlagsEnum>(ReadOnlySpan<Byte>, AsnEncodingRules, Int32, Nullable<Asn1Tag>)

Reads a NamedBitList from source with a specified tag under the specified encoding rules, converting it to the [FlagsAttribute] enum specified by TFlagsEnum.

ReadNull(ReadOnlySpan<Byte>, AsnEncodingRules, Int32, Nullable<Asn1Tag>)

Reads a Null value from source with a specified tag under the specified encoding rules.

ReadObjectIdentifier(ReadOnlySpan<Byte>, AsnEncodingRules, Int32, Nullable<Asn1Tag>)

Reads an Object Identifier value from source with a specified tag under the specified encoding rules.

ReadOctetString(ReadOnlySpan<Byte>, AsnEncodingRules, Int32, Nullable<Asn1Tag>)

Reads an Octet String value from source with a specified tag under the specified encoding rules, returning the contents in a new array.

ReadSequence(ReadOnlySpan<Byte>, AsnEncodingRules, Int32, Int32, Int32, Nullable<Asn1Tag>)

Reads a Sequence or Sequence-Of value from source with a specified tag under the specified encoding rules.

ReadSetOf(ReadOnlySpan<Byte>, AsnEncodingRules, Int32, Int32, Int32, Boolean, Nullable<Asn1Tag>)

Reads a Set-Of value from source with a specified tag under the specified encoding rules.

ReadUtcTime(ReadOnlySpan<Byte>, AsnEncodingRules, Int32, Int32, Nullable<Asn1Tag>)

Reads a UtcTime value from source with a specified tag under the specified encoding rules.

TryDecodeLength(ReadOnlySpan<Byte>, AsnEncodingRules, Nullable<Int32>, Int32)

Attempts to decode the data in source as a length value under the specified encoding rules.

TryReadBitString(ReadOnlySpan<Byte>, Span<Byte>, AsnEncodingRules, Int32, Int32, Int32, Nullable<Asn1Tag>)

Attempts to copy a Bit String value from source with a specified tag under the specified encoding rules into destination.

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

Reads a character string value from source with a specified tag under the specified encoding rules, copying the decoded string into a provided destination buffer.

TryReadCharacterStringBytes(ReadOnlySpan<Byte>, Span<Byte>, AsnEncodingRules, Asn1Tag, Int32, Int32)

Attempts to read a character string value from source with a specified tag under the specified encoding rules, copying the unprocessed bytes into the provided destination buffer.

TryReadEncodedValue(ReadOnlySpan<Byte>, AsnEncodingRules, Asn1Tag, Int32, Int32, Int32)

Attempts to locate the contents range for the encoded value at the beginning of the source buffer using the specified encoding rules.

TryReadInt32(ReadOnlySpan<Byte>, AsnEncodingRules, Int32, Int32, Nullable<Asn1Tag>)

Attempts to read an Integer value from source with a specified tag under the specified encoding rules as a signed 32-bit value.

TryReadInt64(ReadOnlySpan<Byte>, AsnEncodingRules, Int64, Int32, Nullable<Asn1Tag>)

Attempts to read an Integer value from source with a specified tag under the specified encoding rules as a signed 64-bit value.

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

Attempts to get an Octet String value from source with a specified tag under the specified encoding rules, copying the value into the provided destination buffer.

TryReadPrimitiveBitString(ReadOnlySpan<Byte>, AsnEncodingRules, Int32, ReadOnlySpan<Byte>, Int32, Nullable<Asn1Tag>)

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

TryReadPrimitiveCharacterStringBytes(ReadOnlySpan<Byte>, AsnEncodingRules, Asn1Tag, ReadOnlySpan<Byte>, Int32)

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.

TryReadPrimitiveOctetString(ReadOnlySpan<Byte>, AsnEncodingRules, ReadOnlySpan<Byte>, Int32, Nullable<Asn1Tag>)

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

TryReadUInt32(ReadOnlySpan<Byte>, AsnEncodingRules, UInt32, Int32, Nullable<Asn1Tag>)

Attempts to read an Integer value from source with a specified tag under the specified encoding rules as an unsigned 32-bit value.

TryReadUInt64(ReadOnlySpan<Byte>, AsnEncodingRules, UInt64, Int32, Nullable<Asn1Tag>)

Attempts to read an Integer value from source with a specified tag under the specified encoding rules as an unsigned 64-bit value.

Applies to

Producto Versiones
.NET 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)