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

Unified Diff: net/base/cert_verify_proc_mac.cc

Issue 10825211: Implement SHA-256 fingerprint support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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/cert_verify_proc_mac.cc
===================================================================
--- net/base/cert_verify_proc_mac.cc (revision 150170)
+++ net/base/cert_verify_proc_mac.cc (working copy)
@@ -8,6 +8,9 @@
#include <CoreServices/CoreServices.h>
#include <Security/Security.h>
+#include <string>
+#include <vector>
+
#include "base/logging.h"
#include "base/mac/mac_logging.h"
#include "base/mac/scoped_cftyperef.h"
@@ -231,7 +234,7 @@
}
void AppendPublicKeyHashes(CFArrayRef chain,
- std::vector<SHA1Fingerprint>* hashes) {
+ std::vector<HashValueVector>* hashes) {
const CFIndex n = CFArrayGetCount(chain);
for (CFIndex i = 0; i < n; i++) {
SecCertificateRef cert = reinterpret_cast<SecCertificateRef>(
@@ -246,9 +249,15 @@
if (!asn1::ExtractSPKIFromDERCert(der_bytes, &spki_bytes))
continue;
- SHA1Fingerprint hash;
- CC_SHA1(spki_bytes.data(), spki_bytes.size(), hash.data);
- hashes->push_back(hash);
+ HashValue sha1;
+ sha1.tag = HASH_VALUE_SHA1;
+ CC_SHA1(spki_bytes.data(), spki_bytes.size(), sha1.data());
+ (*hashes)[HASH_VALUE_SHA1].push_back(sha1);
+
+ HashValue sha256;
+ sha256.tag = HASH_VALUE_SHA256;
+ CC_SHA256(spki_bytes.data(), spki_bytes.size(), sha256.data());
+ (*hashes)[HASH_VALUE_SHA256].push_back(sha256);
}
}
@@ -325,7 +334,7 @@
return false;
SecCertificateRef root_ref = reinterpret_cast<SecCertificateRef>(
const_cast<void*>(CFArrayGetValueAtIndex(chain, n - 1)));
- SHA1Fingerprint hash = X509Certificate::CalculateFingerprint(root_ref);
+ SHA1HashValue hash = X509Certificate::CalculateFingerprint(root_ref);
return IsSHA1HashInSortedArray(
hash, &kKnownRootCertSHA1Hashes[0][0], sizeof(kKnownRootCertSHA1Hashes));
}

Powered by Google App Engine
This is Rietveld 408576698