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

Unified Diff: net/cert/x509_certificate_win.cc

Issue 462543002: Certificate Transparency: Code for unpacking EV cert hashes whitelist (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments + adding method for determining presence of valid EV whitelist. Created 6 years, 3 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/x509_certificate_unittest.cc ('k') | net/net.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/x509_certificate_win.cc
diff --git a/net/cert/x509_certificate_win.cc b/net/cert/x509_certificate_win.cc
index c679107371a8594e8202b725bf4078d46f7b8074..80085427350b1dc0b4d134ac3f9249995ebcb3ad 100644
--- a/net/cert/x509_certificate_win.cc
+++ b/net/cert/x509_certificate_win.cc
@@ -313,6 +313,27 @@ SHA1HashValue X509Certificate::CalculateFingerprint(
return sha1;
}
+// static
+SHA256HashValue X509Certificate::CalculateFingerprint256(OSCertHandle cert) {
+ DCHECK(NULL != cert->pbCertEncoded);
+ DCHECK_NE(static_cast<DWORD>(0), cert->cbCertEncoded);
+
+ BOOL rv;
+ SHA256HashValue sha256;
+ DWORD sha256_size = sizeof(sha256.data);
+ rv = CryptHashCertificate(NULL,
+ CALG_SHA_256,
+ 0,
+ cert->pbCertEncoded,
+ cert->cbCertEncoded,
+ sha256.data,
+ &sha256_size);
+ DCHECK(rv && sha256_size == sizeof(sha256.data));
+ if (!rv)
+ memset(sha256.data, 0, sizeof(sha256.data));
+ return sha256;
+}
+
// TODO(wtc): This function is implemented with NSS low-level hash
// functions to ensure it is fast. Reimplement this function with
// CryptoAPI. May need to cache the HCRYPTPROV to reduce the overhead.
« no previous file with comments | « net/cert/x509_certificate_unittest.cc ('k') | net/net.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698