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

Unified Diff: net/base/keygen_handler_mac.cc

Issue 1742873002: Switch //net to the new SPKI and PKCS#8 APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@spki-crypto
Patch Set: tweak keygen_handler_openssl.cc 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/android/network_library.h ('k') | net/base/keygen_handler_openssl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/keygen_handler_mac.cc
diff --git a/net/base/keygen_handler_mac.cc b/net/base/keygen_handler_mac.cc
index 63ea84751aa1d926cc7fb215edf03d5431567204..ed0439c53f0f3746d2ca72dd156600563d73fe99 100644
--- a/net/base/keygen_handler_mac.cc
+++ b/net/base/keygen_handler_mac.cc
@@ -148,10 +148,15 @@ std::string KeygenHandler::GenKeyAndSignChallenge() {
goto failure;
}
+ // The DER encoding of a NULL.
+ static const uint8_t kNullDer[] = {0x05, 0x00};
+
// Fill in and DER-encode the PublicKeyAndChallenge:
SignedPublicKeyAndChallenge spkac;
memset(&spkac, 0, sizeof(spkac));
spkac.pkac.spki.algorithm.algorithm = CSSMOID_RSA;
+ spkac.pkac.spki.algorithm.parameters.Data = const_cast<uint8_t*>(kNullDer);
+ spkac.pkac.spki.algorithm.parameters.Length = sizeof(kNullDer);
spkac.pkac.spki.subjectPublicKey.Length =
CFDataGetLength(key_data) * 8; // interpreted as a _bit_ count
spkac.pkac.spki.subjectPublicKey.Data =
@@ -175,6 +180,8 @@ std::string KeygenHandler::GenKeyAndSignChallenge() {
spkac.signature.Data = signature.Data;
spkac.signature.Length = signature.Length * 8; // a _bit_ count
spkac.signature_algorithm.algorithm = CSSMOID_MD5WithRSA;
+ spkac.signature_algorithm.parameters.Data = const_cast<uint8_t*>(kNullDer);
+ spkac.signature_algorithm.parameters.Length = sizeof(kNullDer);
// TODO(snej): MD5 is weak. Can we use SHA1 instead?
// See <https://bugzilla.mozilla.org/show_bug.cgi?id=549460>
« no previous file with comments | « net/android/network_library.h ('k') | net/base/keygen_handler_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698