AsnWriter
A writer for BER-encoded, CER-encoded, and DER-encoded ASN.1 data.
Represents a pushed ASN.1 scope.
Gets the encoding rules in use by this writer.
Creates a new AsnWriter with a given set of encoding rules.
Initializes a new instance of AsnWriter with a given set of encoding rules and an initial capacity.
Copies the value of this writer into another.
Writes the encoded representation of the data to destination.
Returns a new array containing the encoded value.
Determines if Encode would produce an output identical to
other.
Determines if Encode would produce an output identical to
other.
Gets the number of bytes that would be written by TryEncode.
Indicate that the open Octet String with the tag UNIVERSAL 4 is closed,
returning the writer to the parent context.
Indicate that the open Sequence with the specified tag is closed,
returning the writer to the parent context.
Indicate that the open Set-Of with the specified tag is closed,
returning the writer to the parent context.
Begin writing an Octet String value with a specified tag.
Begin writing a Sequence with a specified tag.
Begin writing a Set-Of with a specified tag.
Resets the writer to have no data, without releasing resources.
Attempts to write the encoded representation of the data to destination.
public void WriteBitString(ReadOnlySpan<byte> value, int unusedBitCount = 0, Asn1Tag? tag = default)
Write a Bit String value with a specified tag.
Write a Boolean value with a specified tag.
public void WriteCharacterString(UniversalTagNumber encodingType, string value, Asn1Tag? tag = default)
Write the provided string using the specified encoding type using the specified
tag corresponding to the encoding type.
public void WriteCharacterString(UniversalTagNumber encodingType, ReadOnlySpan<char> str, Asn1Tag? tag = default)
Write the provided string using the specified encoding type using the specified
tag corresponding to the encoding type.
Writes a single value that has already been encoded.
Write a non-[ FlagsAttribute] enum value as an Enumerated with
tag UNIVERSAL 10.
Write a non-[ FlagsAttribute] enum value as an Enumerated with
tag UNIVERSAL 10.
public void WriteGeneralizedTime(DateTimeOffset value, bool omitFractionalSeconds = false, Asn1Tag? tag = default)
Write the provided DateTimeOffset as a GeneralizedTime with a specified
UNIVERSAL 24, optionally excluding the fractional seconds.
Write an Integer value with a specified tag.
Write an Integer value with a specified tag.
Write an Integer value with a specified tag.
Write an Integer value with a specified tag.
Write an Integer value with a specified tag.
Write a [ FlagsAttribute] enum value as a NamedBitList with
a specified tag.
Write a [ FlagsAttribute] enum value as a NamedBitList with
a specified tag.
Write a bit array value as a NamedBitList with a specified tag.
Write NULL with a specified tag.
Write an Object Identifier with a specified tag.
Write an Object Identifier with a specified tag.
Write an Octet String value with a specified tag.
Write the provided value as a UTCTime with a specified tag,
accepting the two-digit year as valid in context.
Write the provided value as a UTCTime with a specified tag,
provided the year is in the allowed range.