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

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: rebase Created 5 years, 5 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 90646a729a85e9bfc9c8ec90f66c1690da001831..1d9ec89488c12360a47eba95a10807b7d81bcfc5 100644
--- a/net/cert/internal/signature_algorithm_unittest.cc
+++ b/net/cert/internal/signature_algorithm_unittest.cc
@@ -94,6 +94,43 @@ TEST(SignatureAlgorithmTest, ParseDer_sha1WithRSAEncryption_NonNullParams) {
ASSERT_FALSE(ParseDer(kData, &algorithm));
}
+// 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
+ scoped_ptr<SignatureAlgorithm> algorithm;
+ ASSERT_TRUE(ParseDer(kData, &algorithm));
+
+ EXPECT_EQ(SignatureAlgorithmId::RsaPkcs1, algorithm->algorithm());
+ EXPECT_EQ(DigestAlgorithm::Sha1, algorithm->digest());
+}
+
+// Parses a sha1WithRSASignature which contains no parameters field.
+//
+// SEQUENCE (1 elem)
+// OBJECT IDENTIFIER 1.3.14.3.2.29
+TEST(SignatureAlgorithmTest, ParseDer_sha1WithRSASignature_NoParams) {
+ // clang-format off
+ const uint8_t kData[] = {
+ 0x30, 0x07, // SEQUENCE (7 bytes)
+ 0x06, 0x05, // OBJECT IDENTIFIER (5 bytes)
+ 0x2b, 0x0e, 0x03, 0x02, 0x1d,
+ };
+ // clang-format on
+ scoped_ptr<SignatureAlgorithm> algorithm;
+ ASSERT_FALSE(ParseDer(kData, &algorithm));
+}
+
// Parses a sha1WithRSAEncryption which contains values after the sequence.
//
// SEQUENCE (2 elem)
« 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