Pkcs7SignerInfo constructor Null safety

Pkcs7SignerInfo(
  1. ASN1Sequence asn1
)

parse a Pkcs7 message signature

Implementation

factory Pkcs7SignerInfo(ASN1Sequence asn1) {
  ASN1Object? signedAttrs;
  ASN1Sequence? signatureAlgorithm;
  ASN1OctetString? signature;
  ASN1Object? unsignedAttrs;

  for (final e in asn1.elements!.sublist(3)) {
    if (e.tag == 0xa0) {
      signedAttrs = e;
    } else if (e.tag == 0xa1) {
      unsignedAttrs = e;
    } else if (e is ASN1Sequence) {
      signatureAlgorithm = e;
    } else if (e is ASN1OctetString) {
      signature = e;
    }
  }

  return Pkcs7SignerInfo._(
    asn1,
    signedAttrs,
    signatureAlgorithm!,
    signature!,
    unsignedAttrs,
  );
}