commonDigestAlgorithm method Null safety

HashAlgorithm commonDigestAlgorithm(
  1. ASN1ObjectIdentifier signatureAlgorithmID
)

Implementation

HashAlgorithm commonDigestAlgorithm(
    ASN1ObjectIdentifier signatureAlgorithmID) {
  switch (signatureAlgorithmID.objectIdentifierAsString) {
    case sha1WithRsaSignature:
    case sha1:
      return HashAlgorithm.sha1;
    case sha256:
    case sha256Nist:
    case ec256:
      return HashAlgorithm.sha256;
    case sha384:
      return HashAlgorithm.sha384;
    case sha512:
      return HashAlgorithm.sha512;
  }

  throw UnimplementedError(
      'Unsupported signature digest ${signatureAlgorithmID.objectIdentifierAsString}');
}