| Index: net/cert/internal/signature_algorithm_unittest.cc
|
| diff --git a/net/cert/internal/signature_algorithm_unittest.cc b/net/cert/internal/signature_algorithm_unittest.cc
|
| index 2c124ada0d6e00e5c6cd331dcea626f52a815937..6e7c47318b98dca68e809e3df73a748fb97c0d73 100644
|
| --- a/net/cert/internal/signature_algorithm_unittest.cc
|
| +++ b/net/cert/internal/signature_algorithm_unittest.cc
|
| @@ -1064,6 +1064,69 @@ TEST(SignatureAlgorithmTest, ParseDerRsaPssNonDefaultHashAndMaskGenAndSalt) {
|
| EXPECT_EQ(10u, params->salt_length());
|
| }
|
|
|
| +// Parses a md5WithRSAEncryption which contains a NULL parameters field.
|
| +//
|
| +// SEQUENCE (2 elem)
|
| +// OBJECT IDENTIFIER 1.2.840.113549.1.1.4
|
| +// NULL
|
| +TEST(SignatureAlgorithmTest, ParseDerMd5WithRsaEncryptionNullParams) {
|
| + // clang-format off
|
| + const uint8_t kData[] = {
|
| + 0x30, 0x0D, // SEQUENCE (13 bytes)
|
| + 0x06, 0x09, // OBJECT IDENTIFIER (9 bytes)
|
| + 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04,
|
| + 0x05, 0x00, // NULL (0 bytes)
|
| + };
|
| + // clang-format on
|
| + std::unique_ptr<SignatureAlgorithm> algorithm;
|
| + ASSERT_TRUE(ParseDer(kData, &algorithm));
|
| +
|
| + EXPECT_EQ(SignatureAlgorithmId::RsaPkcs1, algorithm->algorithm());
|
| + EXPECT_EQ(DigestAlgorithm::Md5, algorithm->digest());
|
| +}
|
| +
|
| +// Parses a md4WithRSAEncryption which contains a NULL parameters field.
|
| +//
|
| +// SEQUENCE (2 elem)
|
| +// OBJECT IDENTIFIER 1.2.840.113549.1.1.3
|
| +// NULL
|
| +TEST(SignatureAlgorithmTest, ParseDerMd4WithRsaEncryptionNullParams) {
|
| + // clang-format off
|
| + const uint8_t kData[] = {
|
| + 0x30, 0x0D, // SEQUENCE (13 bytes)
|
| + 0x06, 0x09, // OBJECT IDENTIFIER (9 bytes)
|
| + 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x03,
|
| + 0x05, 0x00, // NULL (0 bytes)
|
| + };
|
| + // clang-format on
|
| + std::unique_ptr<SignatureAlgorithm> algorithm;
|
| + ASSERT_TRUE(ParseDer(kData, &algorithm));
|
| +
|
| + EXPECT_EQ(SignatureAlgorithmId::RsaPkcs1, algorithm->algorithm());
|
| + EXPECT_EQ(DigestAlgorithm::Md4, algorithm->digest());
|
| +}
|
| +
|
| +// Parses a md2WithRSAEncryption which contains a NULL parameters field.
|
| +//
|
| +// SEQUENCE (2 elem)
|
| +// OBJECT IDENTIFIER 1.2.840.113549.1.1.2
|
| +// NULL
|
| +TEST(SignatureAlgorithmTest, ParseDerMd2WithRsaEncryptionNullParams) {
|
| + // clang-format off
|
| + const uint8_t kData[] = {
|
| + 0x30, 0x0D, // SEQUENCE (13 bytes)
|
| + 0x06, 0x09, // OBJECT IDENTIFIER (9 bytes)
|
| + 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x02,
|
| + 0x05, 0x00, // NULL (0 bytes)
|
| + };
|
| + // clang-format on
|
| + std::unique_ptr<SignatureAlgorithm> algorithm;
|
| + ASSERT_TRUE(ParseDer(kData, &algorithm));
|
| +
|
| + EXPECT_EQ(SignatureAlgorithmId::RsaPkcs1, algorithm->algorithm());
|
| + EXPECT_EQ(DigestAlgorithm::Md2, algorithm->digest());
|
| +}
|
| +
|
| } // namespace
|
|
|
| } // namespace net
|
|
|