ASN1BitString.fromBytes constructor

ASN1BitString.fromBytes(
  1. Uint8List bytes
)

Creates an ASN1BitString entity from the given encodedBytes.

Implementation

ASN1BitString.fromBytes(Uint8List super.bytes) : super.fromBytes() {
  if (ASN1Utils.isConstructed(encodedBytes!.elementAt(0))) {
    elements = [];
    var parser = ASN1Parser(valueBytes);
    stringValues = [];
    while (parser.hasNext()) {
      var bitString = parser.nextObject() as ASN1BitString;
      stringValues!.addAll(bitString.stringValues!);
      elements!.add(bitString);
    }
  } else {
    unusedbits = valueBytes![0];
    stringValues = valueBytes!.sublist(1);
  }
}