ASN1Object class

Holds the encoded and decoded representation of an ASN1 object.

Object are allocated in two ways:

/// A value can be supplied representing the ASN1 Type for the object (Integer, String, etc.). The encoded bytes can be read by calling encodedBytes. /// Conversely, the object can be initialized from an incoming BER byte array. Using ASN1Object.fromBytes(). This byte stream can then be decoded to its correspoding ASN1 type.

Implementers

Constructors

ASN1Object({int tag = 0})
Create an ASN1Object. Optionally set the tag
ASN1Object.fromBytes(Uint8List bytes)
Create an ASN1Object from the given bytes.
ASN1Object.preEncoded(int tag, Uint8List valBytes)
Create an object that encapsulates a set of value bytes that are already encoded.

Properties

encodedBytes Uint8List
Get the encoded byte representation for this object. This can trigger calling the subclasss _encode method if the object has not yet been encoded
no setter
extendedTag int?
no setter
hasExtendedTag bool
no setter
hashCode int
The hash code for this object.
no setterinherited
isEncoded bool
Check if the encoding is ready.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tag int
The BER tag representing this object
final
totalEncodedByteLength int
The total length of this object in bytes - including its value bytes and the encoded tag and length bytes.
no setter

Methods

contentBytes() Uint8List
Returns the real content of a tag. This might be equal to valueBytes for some tags.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toHexString() String
toString() String
A string representation of this object.
override
valueBytes() Uint8List
Return just the value bytes.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

decodeLength(Uint8List encodedBytes, {int offset = 1}) → (int, int)
Decode the asn1 length field from the encoded bytes
encodeLength(int length) Uint8List
Encode a BER length - into 1 to 5 bytes as appropriate Values less than <= 127 are encoded in a single byte If the value is larger than 127, the first byte contains 0x80 + the number of following bytes used to represent the length The length is encoded by the ///fewest/// number of bytes possible - treated as an unsigned binary value.