Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Unified Diff: net/cert/internal/signature_algorithm_unittest.cc

Issue 1690123002: Reduce Certificate Parsing Strictness (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing 21 octet weakness. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/cert/internal/signature_algorithm.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 0336c57925526906e6e98da26a93bf61810fc195..fe5dc2fab8ae21c52f5c3ef97eae1203329bc5d1 100644
--- a/net/cert/internal/signature_algorithm_unittest.cc
+++ b/net/cert/internal/signature_algorithm_unittest.cc
@@ -72,7 +72,10 @@ TEST(SignatureAlgorithmTest, ParseDerSha1WithRSAEncryptionNoParams) {
};
// clang-format on
scoped_ptr<SignatureAlgorithm> algorithm;
- ASSERT_FALSE(ParseDer(kData, &algorithm));
+ ASSERT_TRUE(ParseDer(kData, &algorithm));
+
+ EXPECT_EQ(SignatureAlgorithmId::RsaPkcs1, algorithm->algorithm());
+ EXPECT_EQ(DigestAlgorithm::Sha1, algorithm->digest());
}
// Parses a sha1WithRSAEncryption which contains an unexpected parameters
@@ -128,7 +131,10 @@ TEST(SignatureAlgorithmTest, ParseDerSha1WithRSASignatureNoParams) {
};
// clang-format on
scoped_ptr<SignatureAlgorithm> algorithm;
- ASSERT_FALSE(ParseDer(kData, &algorithm));
+ ASSERT_TRUE(ParseDer(kData, &algorithm));
+
+ EXPECT_EQ(SignatureAlgorithmId::RsaPkcs1, algorithm->algorithm());
+ EXPECT_EQ(DigestAlgorithm::Sha1, algorithm->digest());
}
// Parses a sha1WithRSAEncryption which contains values after the sequence.
@@ -240,7 +246,10 @@ TEST(SignatureAlgorithmTest, ParseDerSha256WithRSAEncryptionNoParams) {
};
// clang-format on
scoped_ptr<SignatureAlgorithm> algorithm;
- ASSERT_FALSE(ParseDer(kData, &algorithm));
+ ASSERT_TRUE(ParseDer(kData, &algorithm));
+
+ EXPECT_EQ(SignatureAlgorithmId::RsaPkcs1, algorithm->algorithm());
+ EXPECT_EQ(DigestAlgorithm::Sha256, algorithm->digest());
}
// Parses a sha384WithRSAEncryption which contains a NULL parameters field.
@@ -277,7 +286,10 @@ TEST(SignatureAlgorithmTest, ParseDerSha384WithRSAEncryptionNoParams) {
};
// clang-format on
scoped_ptr<SignatureAlgorithm> algorithm;
- ASSERT_FALSE(ParseDer(kData, &algorithm));
+ ASSERT_TRUE(ParseDer(kData, &algorithm));
+
+ EXPECT_EQ(SignatureAlgorithmId::RsaPkcs1, algorithm->algorithm());
+ EXPECT_EQ(DigestAlgorithm::Sha384, algorithm->digest());
}
// Parses a sha512WithRSAEncryption which contains a NULL parameters field.
@@ -314,7 +326,10 @@ TEST(SignatureAlgorithmTest, ParseDerSha512WithRSAEncryptionNoParams) {
};
// clang-format on
scoped_ptr<SignatureAlgorithm> algorithm;
- ASSERT_FALSE(ParseDer(kData, &algorithm));
+ ASSERT_TRUE(ParseDer(kData, &algorithm));
+
+ EXPECT_EQ(SignatureAlgorithmId::RsaPkcs1, algorithm->algorithm());
+ EXPECT_EQ(DigestAlgorithm::Sha512, algorithm->digest());
}
// Parses a sha224WithRSAEncryption which contains a NULL parameters field.
« no previous file with comments | « net/cert/internal/signature_algorithm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698