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

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

Issue 8414047: Make X509Certificate::GetDEREncoded a static function taking an OSCertHandle (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Errant comment Created 9 years, 1 month 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 // motivations described in http://src.chromium.org/viewvc/chrome?view=rev&rev ision=80778 523 // motivations described in http://src.chromium.org/viewvc/chrome?view=rev&rev ision=80778
524 // become an issue on OpenSSL builds, we will need to embed a hardcoded list 524 // become an issue on OpenSSL builds, we will need to embed a hardcoded list
525 // of well known root CAs, as per the _mac and _win versions. 525 // of well known root CAs, as per the _mac and _win versions.
526 verify_result->is_issued_by_known_root = true; 526 verify_result->is_issued_by_known_root = true;
527 527
528 return OK; 528 return OK;
529 } 529 }
530 530
531 #endif // !defined(OS_ANDROID) 531 #endif // !defined(OS_ANDROID)
532 532
533 bool X509Certificate::GetDEREncoded(std::string* encoded) { 533 // static
534 bool X509Certificate::GetDEREncoded(X509Certificate::OSCertHandle cert_handle,
535 std::string* encoded) {
534 DERCache der_cache; 536 DERCache der_cache;
535 if (!GetDERAndCacheIfNeeded(cert_handle_, &der_cache)) 537 if (!GetDERAndCacheIfNeeded(cert_handle, &der_cache))
536 return false; 538 return false;
537 encoded->assign(reinterpret_cast<const char*>(der_cache.data), 539 encoded->assign(reinterpret_cast<const char*>(der_cache.data),
538 der_cache.data_length); 540 der_cache.data_length);
539 return true; 541 return true;
540 } 542 }
541 543
542 // static 544 // static
543 bool X509Certificate::IsSameOSCert(X509Certificate::OSCertHandle a, 545 bool X509Certificate::IsSameOSCert(X509Certificate::OSCertHandle a,
544 X509Certificate::OSCertHandle b) { 546 X509Certificate::OSCertHandle b) {
545 DCHECK(a && b); 547 DCHECK(a && b);
546 if (a == b) 548 if (a == b)
(...skipping 28 matching lines...) Expand all
575 DERCache der_cache; 577 DERCache der_cache;
576 if (!GetDERAndCacheIfNeeded(cert_handle, &der_cache)) 578 if (!GetDERAndCacheIfNeeded(cert_handle, &der_cache))
577 return false; 579 return false;
578 580
579 return pickle->WriteData( 581 return pickle->WriteData(
580 reinterpret_cast<const char*>(der_cache.data), 582 reinterpret_cast<const char*>(der_cache.data),
581 der_cache.data_length); 583 der_cache.data_length);
582 } 584 }
583 585
584 } // namespace net 586 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698