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

Side by Side Diff: net/base/x509_certificate_openssl.cc

Issue 10836150: Revert 150375 - 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/x509_certificate_nss.cc ('k') | net/base/x509_certificate_unittest.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/base/x509_certificate.h" 5 #include "net/base/x509_certificate.h"
6 6
7 #include <openssl/asn1.h> 7 #include <openssl/asn1.h>
8 #include <openssl/crypto.h> 8 #include <openssl/crypto.h>
9 #include <openssl/obj_mac.h> 9 #include <openssl/obj_mac.h>
10 #include <openssl/pem.h> 10 #include <openssl/pem.h>
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 x509_util::ParseDate(X509_get_notBefore(cert_handle_), &valid_start_); 281 x509_util::ParseDate(X509_get_notBefore(cert_handle_), &valid_start_);
282 x509_util::ParseDate(X509_get_notAfter(cert_handle_), &valid_expiry_); 282 x509_util::ParseDate(X509_get_notAfter(cert_handle_), &valid_expiry_);
283 } 283 }
284 284
285 // static 285 // static
286 void X509Certificate::ResetCertStore() { 286 void X509Certificate::ResetCertStore() {
287 X509InitSingleton::GetInstance()->ResetCertStore(); 287 X509InitSingleton::GetInstance()->ResetCertStore();
288 } 288 }
289 289
290 // static 290 // static
291 SHA1HashValue X509Certificate::CalculateFingerprint(OSCertHandle cert) { 291 SHA1Fingerprint X509Certificate::CalculateFingerprint(OSCertHandle cert) {
292 SHA1HashValue sha1; 292 SHA1Fingerprint sha1;
293 unsigned int sha1_size = static_cast<unsigned int>(sizeof(sha1.data)); 293 unsigned int sha1_size = static_cast<unsigned int>(sizeof(sha1.data));
294 int ret = X509_digest(cert, EVP_sha1(), sha1.data, &sha1_size); 294 int ret = X509_digest(cert, EVP_sha1(), sha1.data, &sha1_size);
295 CHECK(ret); 295 CHECK(ret);
296 CHECK_EQ(sha1_size, sizeof(sha1.data)); 296 CHECK_EQ(sha1_size, sizeof(sha1.data));
297 return sha1; 297 return sha1;
298 } 298 }
299 299
300 // static 300 // static
301 SHA1HashValue X509Certificate::CalculateCAFingerprint( 301 SHA1Fingerprint X509Certificate::CalculateCAFingerprint(
302 const OSCertHandles& intermediates) { 302 const OSCertHandles& intermediates) {
303 SHA1HashValue sha1; 303 SHA1Fingerprint sha1;
304 memset(sha1.data, 0, sizeof(sha1.data)); 304 memset(sha1.data, 0, sizeof(sha1.data));
305 305
306 SHA_CTX sha1_ctx; 306 SHA_CTX sha1_ctx;
307 SHA1_Init(&sha1_ctx); 307 SHA1_Init(&sha1_ctx);
308 DERCache der_cache; 308 DERCache der_cache;
309 for (size_t i = 0; i < intermediates.size(); ++i) { 309 for (size_t i = 0; i < intermediates.size(); ++i) {
310 if (!GetDERAndCacheIfNeeded(intermediates[i], &der_cache)) 310 if (!GetDERAndCacheIfNeeded(intermediates[i], &der_cache))
311 return sha1; 311 return sha1;
312 SHA1_Update(&sha1_ctx, der_cache.data, der_cache.data_length); 312 SHA1_Update(&sha1_ctx, der_cache.data, der_cache.data_length);
313 } 313 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 *size_bits = EVP_PKEY_size(key) * 8; 463 *size_bits = EVP_PKEY_size(key) * 8;
464 break; 464 break;
465 default: 465 default:
466 *type = kPublicKeyTypeUnknown; 466 *type = kPublicKeyTypeUnknown;
467 *size_bits = 0; 467 *size_bits = 0;
468 break; 468 break;
469 } 469 }
470 } 470 }
471 471
472 } // namespace net 472 } // namespace net
OLDNEW
« no previous file with comments | « net/base/x509_certificate_nss.cc ('k') | net/base/x509_certificate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698