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

Unified Diff: net/base/cert_verify_proc_win.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_win.cc
===================================================================
--- net/base/cert_verify_proc_win.cc (revision 150170)
+++ net/base/cert_verify_proc_win.cc (working copy)
@@ -4,6 +4,9 @@
#include "net/base/cert_verify_proc_win.h"
+#include <string>
+#include <vector>
+
#include "base/memory/scoped_ptr.h"
#include "base/sha1.h"
#include "base/string_util.h"
@@ -282,7 +285,7 @@
PCERT_CHAIN_ELEMENT* element = first_chain->rgpElement;
PCCERT_CONTEXT cert = element[num_elements - 1]->pCertContext;
- SHA1Fingerprint hash = X509Certificate::CalculateFingerprint(cert);
+ SHA1HashValue hash = X509Certificate::CalculateFingerprint(cert);
return IsSHA1HashInSortedArray(
hash, &kKnownRootCertSHA1Hashes[0][0], sizeof(kKnownRootCertSHA1Hashes));
}
@@ -441,7 +444,7 @@
}
void AppendPublicKeyHashes(PCCERT_CHAIN_CONTEXT chain,
- std::vector<SHA1Fingerprint>* hashes) {
+ std::vector<HashValueVector>* hashes) {
if (chain->cChain == 0)
return;
@@ -459,10 +462,16 @@
if (!asn1::ExtractSPKIFromDERCert(der_bytes, &spki_bytes))
continue;
- SHA1Fingerprint hash;
+ HashValue sha1;
+ sha1.tag = HASH_VALUE_SHA1;
base::SHA1HashBytes(reinterpret_cast<const uint8*>(spki_bytes.data()),
- spki_bytes.size(), hash.data);
- hashes->push_back(hash);
+ spki_bytes.size(), sha1.data());
+ (*hashes)[HASH_VALUE_SHA1].push_back(sha1);
+
+ HashValue sha256;
+ sha256.tag = HASH_VALUE_SHA256;
+ crypto::SHA256HashString(spki_bytes, sha1.data(), crypto::kSHA256Length);
+ (*hashes)[HASH_VALUE_SHA256].push_back(sha256);
}
}
@@ -503,7 +512,7 @@
// Look up the EV policy OID of the root CA.
PCCERT_CONTEXT root_cert = element[num_elements - 1]->pCertContext;
- SHA1Fingerprint fingerprint =
+ SHA1HashValue fingerprint =
X509Certificate::CalculateFingerprint(root_cert);
EVRootCAMetadata* metadata = EVRootCAMetadata::GetInstance();
return metadata->HasEVPolicyOID(fingerprint, policy_oid);

Powered by Google App Engine
This is Rietveld 408576698