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

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: const_cast 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
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);
davidben 2016/03/03 16:22:31 (We could also reimplement this whole thing in CBB
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>

Powered by Google App Engine
This is Rietveld 408576698