AsnWriter Class

Definition

A writer for BER-, CER-, and DER-encoded ASN.1 data.

public ref class AsnWriter sealed
public sealed class AsnWriter
type AsnWriter = class
Public NotInheritable Class AsnWriter
Inheritance
AsnWriter

Constructors

AsnWriter(AsnEncodingRules)

Create a new AsnWriter with a given set of encoding rules.

AsnWriter(AsnEncodingRules, Int32)

Initializes a new instance of AsnWriter with a given set of encoding rules and an initial capacity.

Properties

RuleSet

Gets the encoding rules in use by this writer.

Methods

CopyTo(AsnWriter)

Copy the value of this writer into another.

Encode()

Return a new array containing the encoded value.

Encode(Span<Byte>)

Writes the encoded representation of the data to destination.

EncodedValueEquals(AsnWriter)

Determines if Encode() would produce an output identical to other.

EncodedValueEquals(ReadOnlySpan<Byte>)

Determines if Encode() would produce an output identical to other.

Equals(Object)

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

(Inherited from Object)
GetEncodedLength()

Gets the number of bytes that would be written by TryEncode(Span<Byte>, Int32).

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)
PopOctetString(Nullable<Asn1Tag>)

Indicate that the open Octet String with the tag UNIVERSAL 4 is closed, returning the writer to the parent context.

PopSequence(Nullable<Asn1Tag>)

Indicate that the open Sequence with the specified tag is closed, returning the writer to the parent context.

PopSetOf(Nullable<Asn1Tag>)

Indicate that the open Set-Of with the specified tag is closed, returning the writer to the parent context.

PushOctetString(Nullable<Asn1Tag>)

Begin writing an Octet String value with a specified tag.

PushSequence(Nullable<Asn1Tag>)

Begin writing a Sequence with a specified tag.

PushSetOf(Nullable<Asn1Tag>)

Begin writing a Set-Of with a specified tag.

Reset()

Reset the writer to have no data, without releasing resources.

ToString()

Returns a string that represents the current object.

(Inherited from Object)
TryEncode(Span<Byte>, Int32)

Attempts to write the encoded representation of the data to destination.

WriteBitString(ReadOnlySpan<Byte>, Int32, Nullable<Asn1Tag>)

Write a Bit String value with a specified tag.

WriteBoolean(Boolean, Nullable<Asn1Tag>)

Write a Boolean value with a specified tag.

WriteCharacterString(UniversalTagNumber, ReadOnlySpan<Char>, Nullable<Asn1Tag>)

Write the provided string using the specified encoding type using the specified tag corresponding to the encoding type.

WriteCharacterString(UniversalTagNumber, String, Nullable<Asn1Tag>)

Write the provided string using the specified encoding type using the specified tag corresponding to the encoding type.

WriteEncodedValue(ReadOnlySpan<Byte>)

Write a single value which has already been encoded.

WriteEnumeratedValue(Enum, Nullable<Asn1Tag>)

Write a non-[FlagsAttribute] enum value as an Enumerated with tag UNIVERSAL 10.

WriteEnumeratedValue<TEnum>(TEnum, Nullable<Asn1Tag>)

Write a non-[FlagsAttribute] enum value as an Enumerated with tag UNIVERSAL 10.

WriteGeneralizedTime(DateTimeOffset, Boolean, Nullable<Asn1Tag>)

Write the provided DateTimeOffset as a GeneralizedTime with a specified UNIVERSAL 24, optionally excluding the fractional seconds.

WriteInteger(BigInteger, Nullable<Asn1Tag>)

Write an Integer value with a specified tag.

WriteInteger(Int64, Nullable<Asn1Tag>)

Write an Integer value with a specified tag.

WriteInteger(ReadOnlySpan<Byte>, Nullable<Asn1Tag>)

Write an Integer value with a specified tag.

WriteInteger(UInt64, Nullable<Asn1Tag>)

Write an Integer value with a specified tag.

WriteIntegerUnsigned(ReadOnlySpan<Byte>, Nullable<Asn1Tag>)

Write an Integer value with a specified tag.

WriteNamedBitList(BitArray, Nullable<Asn1Tag>)

Write a bit array value as a NamedBitList with a specified tag.

WriteNamedBitList(Enum, Nullable<Asn1Tag>)

Write a [FlagsAttribute] enum value as a NamedBitList with a specified tag.

WriteNamedBitList<TEnum>(TEnum, Nullable<Asn1Tag>)

Write a [FlagsAttribute] enum value as a NamedBitList with a specified tag.

WriteNull(Nullable<Asn1Tag>)

Write NULL with a specified tag.

WriteObjectIdentifier(ReadOnlySpan<Char>, Nullable<Asn1Tag>)

Write an Object Identifier with a specified tag.

WriteObjectIdentifier(String, Nullable<Asn1Tag>)

Write an Object Identifier with a specified tag.

WriteOctetString(ReadOnlySpan<Byte>, Nullable<Asn1Tag>)

Write an Octet String value with a specified tag.

WriteUtcTime(DateTimeOffset, Int32, Nullable<Asn1Tag>)

Write the provided value as a UTCTime with a specified tag, provided the year is in the allowed range.

WriteUtcTime(DateTimeOffset, Nullable<Asn1Tag>)

Write the provided value as a UTCTime with a specified tag, accepting the two-digit year as valid in context.

Applies to