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

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

Issue 2728953003: Add support for MD2, MD4, and MD5 to SignatureAlgorithm. (Closed)
Patch Set: wow. dumb Created 3 years, 9 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.h ('k') | net/cert/internal/signature_algorithm_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/signature_algorithm.cc
diff --git a/net/cert/internal/signature_algorithm.cc b/net/cert/internal/signature_algorithm.cc
index 0a1b0e610edd09456d74cb6fd793cf00cfcb5011..9853ac024988d47ea2c051313497b71487af5cdb 100644
--- a/net/cert/internal/signature_algorithm.cc
+++ b/net/cert/internal/signature_algorithm.cc
@@ -17,6 +17,21 @@ namespace net {
namespace {
+// md2WithRSAEncryption
+// In dotted notation: 1.2.840.113549.1.1.2
+const uint8_t kOidMd2WithRsaEncryption[] = {0x2a, 0x86, 0x48, 0x86, 0xf7,
+ 0x0d, 0x01, 0x01, 0x02};
+
+// md4WithRSAEncryption
+// In dotted notation: 1.2.840.113549.1.1.3
+const uint8_t kOidMd4WithRsaEncryption[] = {0x2a, 0x86, 0x48, 0x86, 0xf7,
+ 0x0d, 0x01, 0x01, 0x03};
+
+// md5WithRSAEncryption
+// In dotted notation: 1.2.840.113549.1.1.4
+const uint8_t kOidMd5WithRsaEncryption[] = {0x2a, 0x86, 0x48, 0x86, 0xf7,
+ 0x0d, 0x01, 0x01, 0x04};
+
// From RFC 5912:
//
// sha1WithRSAEncryption OBJECT IDENTIFIER ::= {
@@ -516,6 +531,7 @@ WARN_UNUSED_RESULT bool ParseHashAlgorithm(const der::Input input,
} else if (oid == der::Input(kOidSha512)) {
hash = DigestAlgorithm::Sha512;
} else {
+ // TODO(eroman): Support MD2, MD4, MD5 for completeness?
// Unsupported digest algorithm.
return false;
}
@@ -580,6 +596,15 @@ std::unique_ptr<SignatureAlgorithm> SignatureAlgorithm::Create(
if (oid == der::Input(kOidSha1WithRsaSignature))
return ParseRsaPkcs1(DigestAlgorithm::Sha1, params);
+ if (oid == der::Input(kOidMd2WithRsaEncryption))
+ return ParseRsaPkcs1(DigestAlgorithm::Md2, params);
+
+ if (oid == der::Input(kOidMd4WithRsaEncryption))
+ return ParseRsaPkcs1(DigestAlgorithm::Md4, params);
+
+ if (oid == der::Input(kOidMd5WithRsaEncryption))
+ return ParseRsaPkcs1(DigestAlgorithm::Md5, params);
+
// TODO(crbug.com/634443): Add an error indicating what the OID
// was.
« no previous file with comments | « net/cert/internal/signature_algorithm.h ('k') | net/cert/internal/signature_algorithm_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698