ASN1OctetString constructor

ASN1OctetString(
  1. dynamic octets, {
  2. int tag = OCTET_STRING_TYPE,
})

Create an ASN1OctetString initialized with a String or a List<int>. Optionally override the tag

Implementation

ASN1OctetString(dynamic octets, {super.tag = OCTET_STRING_TYPE}) {
  if (octets is String) {
    this.octets = Uint8List.fromList(octets.codeUnits);
  } else if (octets is Uint8List) {
    this.octets = octets;
  } else if (octets is List<int>) {
    this.octets = Uint8List.fromList(octets);
  } else {
    throw ArgumentError(
        'Parameters octets should be either of type String or List<int>.');
  }
}