Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
struct System.​Formats.​Asn1.​Asn1Tag
Assembly: System.Formats.Asn1
Implemented Interfaces
Represents an ASN.1 tag, as described in ITU-T Recommendation X.680.
Fields and Constants
public static readonly
Asn1Tag
Boolean
Represents the universal class tag for a Boolean value.
public static readonly
Asn1Tag
ConstructedBitString
Represents the universal class tag for a Bit String value under a constructed encoding.
public static readonly
Asn1Tag
ConstructedOctetString
Represents the universal class tag for a Octet String value under a constructed encoding.
public static readonly
Asn1Tag
Enumerated
Represents the universal class tag for an Enumerated value.
public static readonly
Asn1Tag
GeneralizedTime
Represents the universal class tag for a GeneralizedTime value.
public static readonly
Asn1Tag
Integer
Represents the universal class tag for an Integer value.
public static readonly
Asn1Tag
Null
Represents the universal class tag for a <c>Null</c> value.
public static readonly
Asn1Tag
ObjectIdentifier
Represents the universal class tag for an Object Identifier value.
public static readonly
Asn1Tag
PrimitiveBitString
Represents the universal class tag for a Bit String value under a primitive encoding.
public static readonly
Asn1Tag
PrimitiveOctetString
Represents the universal class tag for an Octet String value under a primitive encoding.
public static readonly
Asn1Tag
Sequence
Represents the universal class tag for a Sequence value (always a constructed encoding).
public static readonly
Asn1Tag
SetOf
Represents the universal class tag for a SetOf value (always a constructed encoding).
public static readonly
Asn1Tag
UtcTime
Represents the universal class tag for a UtcTime value.
Properties
public
bool
IsConstructed
Gets a value that indicates whether the tag represents a constructed encoding ( <see langword="true" /> ), or
a primitive encoding ( <see langword="false" /> ).
public
TagClass
TagClass
Gets the tag class to which this tag belongs.
public
int
TagValue
Gets the numeric value for this tag.
Remarks If <see cref="P:System.Formats.Asn1.Asn1Tag.TagClass" /> is <see cref="F:System.Formats.Asn1.TagClass.Universal" /> , this value can
be interpreted as a <see cref="T:System.Formats.Asn1.UniversalTagNumber" /> .
Methods
public
Asn1Tag
AsConstructed​()
Produces a tag with the same <see cref="P:System.Formats.Asn1.Asn1Tag.TagClass" /> and
<see cref="P:System.Formats.Asn1.Asn1Tag.TagValue" /> values, but whose <see cref="P:System.Formats.Asn1.Asn1Tag.IsConstructed" /> is <see langword="true" /> .
Returns A tag with the same <see cref="P:System.Formats.Asn1.Asn1Tag.TagClass" /> and <see cref="P:System.Formats.Asn1.Asn1Tag.TagValue" />
values, but whose <see cref="P:System.Formats.Asn1.Asn1Tag.IsConstructed" /> is <see langword="true" /> .
public
Asn1Tag
AsPrimitive​()
Produces a tag with the same <see cref="P:System.Formats.Asn1.Asn1Tag.TagClass" /> and
<see cref="P:System.Formats.Asn1.Asn1Tag.TagValue" /> values, but whose <see cref="P:System.Formats.Asn1.Asn1Tag.IsConstructed" /> is <see langword="false" /> .
Returns A tag with the same <see cref="P:System.Formats.Asn1.Asn1Tag.TagClass" /> and <see cref="P:System.Formats.Asn1.Asn1Tag.TagValue" />
values, but whose <see cref="P:System.Formats.Asn1.Asn1Tag.IsConstructed" /> is <see langword="false" /> .
public
int
CalculateEncodedSize​()
Reports the number of bytes required for the BER-encoding of this tag.
Returns The number of bytes required for the BER-encoding of this tag.
public static
Asn1Tag
Decode​(ReadOnlySpan<​byte> source,
Int32& bytesConsumed)
public
int
Encode​(Span<​byte> destination)
Writes the BER-encoded form of this tag to <paramref name="destination" /> .
Returns The number of bytes written to <paramref name="destination" /> .
destination
The start of where the encoded tag should be written.
public
bool
Equals​(Asn1Tag other)
Tests if <paramref name="other" /> has the same encoding as this tag.
Returns <see langword="true" /> if <paramref name="other" /> has the same values for
<see cref="P:System.Formats.Asn1.Asn1Tag.TagClass" /> , <see cref="P:System.Formats.Asn1.Asn1Tag.TagValue" /> , and <see cref="P:System.Formats.Asn1.Asn1Tag.IsConstructed" /> ;
<see langword="false" /> otherwise.
other
The tag to test for equality.
public
bool
Equals​(object obj)
Tests if <paramref name="obj" /> is an <see cref="T:System.Formats.Asn1.Asn1Tag" /> with the same
encoding as this tag.
Returns <see langword="false" /> if <paramref name="obj" /> is not an <see cref="T:System.Formats.Asn1.Asn1Tag" /> ,
<see cref="M:System.Formats.Asn1.Asn1Tag.Equals(System.Formats.Asn1.Asn1Tag)" /> otherwise.
obj
The object to test for value equality.
public
int
GetHashCode​()
Returns the hash code for this instance.
Returns A 32-bit signed integer hash code.
public
bool
HasSameClassAndValue​(Asn1Tag other)
Tests if <paramref name="other" /> has the same <see cref="P:System.Formats.Asn1.Asn1Tag.TagClass" /> and <see cref="P:System.Formats.Asn1.Asn1Tag.TagValue" />
values as this tag, and does not compare <see cref="P:System.Formats.Asn1.Asn1Tag.IsConstructed" /> .
Returns <see langword="true" /> if <paramref name="other" /> has the same <see cref="P:System.Formats.Asn1.Asn1Tag.TagClass" /> and <see cref="P:System.Formats.Asn1.Asn1Tag.TagValue" />
as this tag, <see langword="false" /> otherwise.
other
Tag to test for concept equality.
public
string
ToString​()
Provides a text representation of this tag suitable for debugging.
Returns A text representation of this tag suitable for debugging.
public static
bool
TryDecode​(ReadOnlySpan<​byte> source,
Asn1Tag& tag,
Int32& bytesConsumed)
protected
void
Finalize​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object