ASN1IA5String.fromBytes constructor

ASN1IA5String.fromBytes(
  1. Uint8List encodedBytes
)

Creates an ASN1IA5String entity from the given encodedBytes.

Implementation

ASN1IA5String.fromBytes(Uint8List encodedBytes)
    : super.fromBytes(encodedBytes) {
  if (ASN1Utils.isConstructed(encodedBytes.elementAt(0))) {
    elements = [];
    var parser = ASN1Parser(valueBytes);
    var sb = StringBuffer();
    while (parser.hasNext()) {
      var ia5String = parser.nextObject() as ASN1IA5String;
      sb.write(ia5String.stringValue);
      elements!.add(ia5String);
    }
    stringValue = sb.toString();
  } else {
    stringValue = ascii.decode(valueBytes!);
  }
}