OLD | NEW |
---|---|
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 <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
690 std::string der_encoded; | 690 std::string der_encoded; |
691 if (!GetDEREncoded(cert_handle, &der_encoded)) | 691 if (!GetDEREncoded(cert_handle, &der_encoded)) |
692 return false; | 692 return false; |
693 return GetPEMEncodedFromDER(der_encoded, pem_encoded); | 693 return GetPEMEncodedFromDER(der_encoded, pem_encoded); |
694 } | 694 } |
695 | 695 |
696 bool X509Certificate::GetPEMEncodedChain( | 696 bool X509Certificate::GetPEMEncodedChain( |
697 std::vector<std::string>* pem_encoded) const { | 697 std::vector<std::string>* pem_encoded) const { |
698 std::vector<std::string> encoded_chain; | 698 std::vector<std::string> encoded_chain; |
699 std::string pem_data; | 699 std::string pem_data; |
700 if (!GetPEMEncoded(os_cert_handle(), &pem_data)) | 700 if (!os_cert_handle() || !GetPEMEncoded(os_cert_handle(), &pem_data)) |
agl
2014/09/23 19:59:44
Should this not be fixed in GetDEREncoded and thus
felt
2014/09/23 20:26:50
sure, did this.
| |
701 return false; | 701 return false; |
702 encoded_chain.push_back(pem_data); | 702 encoded_chain.push_back(pem_data); |
703 for (size_t i = 0; i < intermediate_ca_certs_.size(); ++i) { | 703 for (size_t i = 0; i < intermediate_ca_certs_.size(); ++i) { |
704 if (!GetPEMEncoded(intermediate_ca_certs_[i], &pem_data)) | 704 if (!GetPEMEncoded(intermediate_ca_certs_[i], &pem_data)) |
705 return false; | 705 return false; |
706 encoded_chain.push_back(pem_data); | 706 encoded_chain.push_back(pem_data); |
707 } | 707 } |
708 pem_encoded->swap(encoded_chain); | 708 pem_encoded->swap(encoded_chain); |
709 return true; | 709 return true; |
710 } | 710 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
762 RemoveFromCache(cert_handle_); | 762 RemoveFromCache(cert_handle_); |
763 FreeOSCertHandle(cert_handle_); | 763 FreeOSCertHandle(cert_handle_); |
764 } | 764 } |
765 for (size_t i = 0; i < intermediate_ca_certs_.size(); ++i) { | 765 for (size_t i = 0; i < intermediate_ca_certs_.size(); ++i) { |
766 RemoveFromCache(intermediate_ca_certs_[i]); | 766 RemoveFromCache(intermediate_ca_certs_[i]); |
767 FreeOSCertHandle(intermediate_ca_certs_[i]); | 767 FreeOSCertHandle(intermediate_ca_certs_[i]); |
768 } | 768 } |
769 } | 769 } |
770 | 770 |
771 } // namespace net | 771 } // namespace net |
OLD | NEW |