OLD | NEW |
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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 // motivations described in http://src.chromium.org/viewvc/chrome?view=rev&rev
ision=80778 | 520 // motivations described in http://src.chromium.org/viewvc/chrome?view=rev&rev
ision=80778 |
521 // become an issue on OpenSSL builds, we will need to embed a hardcoded list | 521 // become an issue on OpenSSL builds, we will need to embed a hardcoded list |
522 // of well known root CAs, as per the _mac and _win versions. | 522 // of well known root CAs, as per the _mac and _win versions. |
523 verify_result->is_issued_by_known_root = true; | 523 verify_result->is_issued_by_known_root = true; |
524 | 524 |
525 return OK; | 525 return OK; |
526 } | 526 } |
527 | 527 |
528 #endif // !defined(OS_ANDROID) | 528 #endif // !defined(OS_ANDROID) |
529 | 529 |
530 bool X509Certificate::GetDEREncoded(std::string* encoded) { | 530 // static |
| 531 bool X509Certificate::GetDEREncoded(X509Certificate::OSCertHandle cert_handle, |
| 532 std::string* encoded) { |
531 DERCache der_cache; | 533 DERCache der_cache; |
532 if (!GetDERAndCacheIfNeeded(cert_handle_, &der_cache)) | 534 if (!GetDERAndCacheIfNeeded(cert_handle, &der_cache)) |
533 return false; | 535 return false; |
534 encoded->assign(reinterpret_cast<const char*>(der_cache.data), | 536 encoded->assign(reinterpret_cast<const char*>(der_cache.data), |
535 der_cache.data_length); | 537 der_cache.data_length); |
536 return true; | 538 return true; |
537 } | 539 } |
538 | 540 |
539 // static | 541 // static |
540 bool X509Certificate::IsSameOSCert(X509Certificate::OSCertHandle a, | 542 bool X509Certificate::IsSameOSCert(X509Certificate::OSCertHandle a, |
541 X509Certificate::OSCertHandle b) { | 543 X509Certificate::OSCertHandle b) { |
542 DCHECK(a && b); | 544 DCHECK(a && b); |
543 if (a == b) | 545 if (a == b) |
(...skipping 28 matching lines...) Expand all Loading... |
572 DERCache der_cache; | 574 DERCache der_cache; |
573 if (!GetDERAndCacheIfNeeded(cert_handle, &der_cache)) | 575 if (!GetDERAndCacheIfNeeded(cert_handle, &der_cache)) |
574 return false; | 576 return false; |
575 | 577 |
576 return pickle->WriteData( | 578 return pickle->WriteData( |
577 reinterpret_cast<const char*>(der_cache.data), | 579 reinterpret_cast<const char*>(der_cache.data), |
578 der_cache.data_length); | 580 der_cache.data_length); |
579 } | 581 } |
580 | 582 |
581 } // namespace net | 583 } // namespace net |
OLD | NEW |