return der::Nested()

in evReady/src/pkix/lib/pkixder.cpp [217:257]


  return der::Nested(input, SEQUENCE, [&algorithm](Reader& r) -> Result {
    Reader algorithmID;
    Result rv = AlgorithmIdentifierValue(r, algorithmID);
    if (rv != Success) {
      return rv;
    }

    // RFC 4055 Section 2.1
    // python DottedOIDToCode.py id-sha1 1.3.14.3.2.26
    static const uint8_t id_sha1[] = {
      0x2b, 0x0e, 0x03, 0x02, 0x1a
    };
    // python DottedOIDToCode.py id-sha256 2.16.840.1.101.3.4.2.1
    static const uint8_t id_sha256[] = {
      0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01
    };
    // python DottedOIDToCode.py id-sha384 2.16.840.1.101.3.4.2.2
    static const uint8_t id_sha384[] = {
      0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02
    };
    // python DottedOIDToCode.py id-sha512 2.16.840.1.101.3.4.2.3
    static const uint8_t id_sha512[] = {
      0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03
    };

    // Matching is attempted based on a rough estimate of the commonality of the
    // algorithm, to minimize the number of MatchRest calls.
    if (algorithmID.MatchRest(id_sha1)) {
      algorithm = DigestAlgorithm::sha1;
    } else if (algorithmID.MatchRest(id_sha256)) {
      algorithm = DigestAlgorithm::sha256;
    } else if (algorithmID.MatchRest(id_sha384)) {
      algorithm = DigestAlgorithm::sha384;
    } else if (algorithmID.MatchRest(id_sha512)) {
      algorithm = DigestAlgorithm::sha512;
    } else {
      return Result::ERROR_INVALID_ALGORITHM;
    }

    return Success;
  });