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

Side by Side Diff: net/cert/x509_certificate_nss.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 unified diff | Download patch
« no previous file with comments | « net/cert/x509_certificate_mac.cc ('k') | net/cert/x509_certificate_openssl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/cert/x509_certificate.h" 5 #include "net/cert/x509_certificate.h"
6 6
7 #include <cert.h> 7 #include <cert.h>
8 #include <cryptohi.h> 8 #include <cryptohi.h>
9 #include <keyhi.h> 9 #include <keyhi.h>
10 #include <nss.h> 10 #include <nss.h>
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 DCHECK_NE(0U, cert->derCert.len); 218 DCHECK_NE(0U, cert->derCert.len);
219 219
220 SECStatus rv = HASH_HashBuf(HASH_AlgSHA1, sha1.data, 220 SECStatus rv = HASH_HashBuf(HASH_AlgSHA1, sha1.data,
221 cert->derCert.data, cert->derCert.len); 221 cert->derCert.data, cert->derCert.len);
222 DCHECK_EQ(SECSuccess, rv); 222 DCHECK_EQ(SECSuccess, rv);
223 223
224 return sha1; 224 return sha1;
225 } 225 }
226 226
227 // static 227 // static
228 SHA256HashValue X509Certificate::CalculateFingerprint256(OSCertHandle cert) {
229 SHA256HashValue sha256;
230 memset(sha256.data, 0, sizeof(sha256.data));
231
232 DCHECK(NULL != cert->derCert.data);
233 DCHECK_NE(0U, cert->derCert.len);
234
235 SECStatus rv = HASH_HashBuf(
236 HASH_AlgSHA256, sha256.data, cert->derCert.data, cert->derCert.len);
237 DCHECK_EQ(SECSuccess, rv);
238
239 return sha256;
240 }
241
242 // static
228 SHA1HashValue X509Certificate::CalculateCAFingerprint( 243 SHA1HashValue X509Certificate::CalculateCAFingerprint(
229 const OSCertHandles& intermediates) { 244 const OSCertHandles& intermediates) {
230 SHA1HashValue sha1; 245 SHA1HashValue sha1;
231 memset(sha1.data, 0, sizeof(sha1.data)); 246 memset(sha1.data, 0, sizeof(sha1.data));
232 247
233 HASHContext* sha1_ctx = HASH_Create(HASH_AlgSHA1); 248 HASHContext* sha1_ctx = HASH_Create(HASH_AlgSHA1);
234 if (!sha1_ctx) 249 if (!sha1_ctx)
235 return sha1; 250 return sha1;
236 HASH_Begin(sha1_ctx); 251 HASH_Begin(sha1_ctx);
237 for (size_t i = 0; i < intermediates.size(); ++i) { 252 for (size_t i = 0; i < intermediates.size(); ++i) {
(...skipping 22 matching lines...) Expand all
260 } 275 }
261 276
262 // static 277 // static
263 void X509Certificate::GetPublicKeyInfo(OSCertHandle cert_handle, 278 void X509Certificate::GetPublicKeyInfo(OSCertHandle cert_handle,
264 size_t* size_bits, 279 size_t* size_bits,
265 PublicKeyType* type) { 280 PublicKeyType* type) {
266 x509_util::GetPublicKeyInfo(cert_handle, size_bits, type); 281 x509_util::GetPublicKeyInfo(cert_handle, size_bits, type);
267 } 282 }
268 283
269 } // namespace net 284 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/x509_certificate_mac.cc ('k') | net/cert/x509_certificate_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698