ASN1CertBag.fromSequence constructor

ASN1CertBag.fromSequence(
  1. ASN1Sequence seq
)

Creates a CertBag object from the given sequence consisting of two elements :

  • ASN1ObjectIdentifier
  • ASN1OctetString or ASN1IA5String

Implementation

ASN1CertBag.fromSequence(ASN1Sequence seq) {
  certId = seq.elements!.elementAt(0) as ASN1ObjectIdentifier;
  if (seq.elements!.length == 2) {
    var el = seq.elements!.elementAt(1);
    if (el.tag == 0xA0) {
      certValue = ASN1Parser(el.valueBytes).nextObject();
    } else {
      certValue = el;
    }
  }
}