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

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

Issue 1223763002: Recognize the legacy OID 1.3.14.3.2.29 (sha1WithRSASignature) as equivalent to (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sign_parse_alg
Patch Set: Created 5 years, 6 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
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 e89e015a40627a59fd62eb0fe1a57395aafeef7e..7bc0c86c4592b719ac69e058bd620ec6c4fd0970 100644
--- a/net/cert/internal/signature_algorithm_unittest.cc
+++ b/net/cert/internal/signature_algorithm_unittest.cc
@@ -88,6 +88,27 @@ TEST(SignatureAlgorithmTest, ParseDer_sha1WithRSAEncryption_NonNullParams) {
ASSERT_FALSE(algorithm.ParseDer(der::Input(kData)));
}
+// Parses a sha1WithRSASignature which contains a NULL parameters field.
+//
+// SEQUENCE (2 elem)
+// OBJECT IDENTIFIER 1.3.14.3.2.29
+// NULL
+TEST(SignatureAlgorithmTest, ParseDer_sha1WithRSASignature_NullParams) {
+ // clang-format off
+ const uint8_t kData[] = {
+ 0x30, 0x09, // SEQUENCE (9 bytes)
+ 0x06, 0x05, // OBJECT IDENTIFIER (5 bytes)
+ 0x2b, 0x0e, 0x03, 0x02, 0x1d,
+ 0x05, 0x00, // NULL (0 bytes)
+ };
+ // clang-format on
+ SignatureAlgorithm algorithm;
+ ASSERT_TRUE(algorithm.ParseDer(der::Input(kData)));
+
+ EXPECT_EQ(SignatureAlgorithmId::RsaPkcs1, algorithm.algorithm());
+ EXPECT_EQ(DigestAlgorithm::Sha1, algorithm.digest());
+}
+
// Parses a sha-1WithRSAEncryption which contains values after the sequence.
//
// SEQUENCE (1 elem)
« net/cert/internal/signature_algorithm.cc ('K') | « net/cert/internal/signature_algorithm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698