addSMimeDigest method Null safety

void addSMimeDigest(
  1. {required Uint8List digest,
  2. DateTime? signingTime}
)

Add the Secure/Multipurpose Internet Mail Extensions digest

Implementation

void addSMimeDigest({required Uint8List digest, DateTime? signingTime}) {
  _authenticatedAttributes.add(ASN1Sequence(elements: [
    ASN1ObjectIdentifier([1, 2, 840, 113549, 1, 9, 3]), // ContentType
    ASN1Set(elements: [
      ASN1ObjectIdentifier([1, 2, 840, 113549, 1, 7, 1]), // Data
    ])
  ]));

  signingTime ??= DateTime.now();
  _authenticatedAttributes.add(ASN1Sequence(elements: [
    ASN1ObjectIdentifier([1, 2, 840, 113549, 1, 9, 5]), // SigningTime
    ASN1Set(elements: [
      ASN1UtcTime(signingTime.toUtc()),
    ])
  ]));

  _authenticatedAttributes.add(ASN1Sequence(elements: [
    ASN1ObjectIdentifier([1, 2, 840, 113549, 1, 9, 4]), // MessageDigest
    ASN1Set(elements: [
      ASN1OctetString(octets: digest),
    ])
  ]));
}