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 <cert.h> | 7 #include <cert.h> |
8 #include <cryptohi.h> | 8 #include <cryptohi.h> |
9 #include <nss.h> | 9 #include <nss.h> |
10 #include <pk11pub.h> | 10 #include <pk11pub.h> |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 DCHECK(!ev_policy_tags.empty()); | 895 DCHECK(!ev_policy_tags.empty()); |
896 | 896 |
897 for (std::vector<SECOidTag>::const_iterator | 897 for (std::vector<SECOidTag>::const_iterator |
898 i = ev_policy_tags.begin(); i != ev_policy_tags.end(); ++i) { | 898 i = ev_policy_tags.begin(); i != ev_policy_tags.end(); ++i) { |
899 if (CheckCertPolicies(cert_handle_, *i)) | 899 if (CheckCertPolicies(cert_handle_, *i)) |
900 return true; | 900 return true; |
901 } | 901 } |
902 return false; | 902 return false; |
903 } | 903 } |
904 | 904 |
905 bool X509Certificate::GetDEREncoded(std::string* encoded) { | 905 // static |
906 if (!cert_handle_->derCert.len) | 906 bool X509Certificate::GetDEREncoded(X509Certificate::OSCertHandle cert_handle, |
| 907 std::string* encoded) { |
| 908 if (!cert_handle->derCert.len) |
907 return false; | 909 return false; |
908 encoded->clear(); | 910 encoded->assign(reinterpret_cast<char*>(cert_handle->derCert.data), |
909 encoded->append(reinterpret_cast<char*>(cert_handle_->derCert.data), | 911 cert_handle->derCert.len); |
910 cert_handle_->derCert.len); | |
911 return true; | 912 return true; |
912 } | 913 } |
913 | 914 |
914 // static | 915 // static |
915 bool X509Certificate::IsSameOSCert(X509Certificate::OSCertHandle a, | 916 bool X509Certificate::IsSameOSCert(X509Certificate::OSCertHandle a, |
916 X509Certificate::OSCertHandle b) { | 917 X509Certificate::OSCertHandle b) { |
917 DCHECK(a && b); | 918 DCHECK(a && b); |
918 if (a == b) | 919 if (a == b) |
919 return true; | 920 return true; |
920 return a->derCert.len == b->derCert.len && | 921 return a->derCert.len == b->derCert.len && |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 | 1041 |
1041 // static | 1042 // static |
1042 bool X509Certificate::WriteOSCertHandleToPickle(OSCertHandle cert_handle, | 1043 bool X509Certificate::WriteOSCertHandleToPickle(OSCertHandle cert_handle, |
1043 Pickle* pickle) { | 1044 Pickle* pickle) { |
1044 return pickle->WriteData( | 1045 return pickle->WriteData( |
1045 reinterpret_cast<const char*>(cert_handle->derCert.data), | 1046 reinterpret_cast<const char*>(cert_handle->derCert.data), |
1046 cert_handle->derCert.len); | 1047 cert_handle->derCert.len); |
1047 } | 1048 } |
1048 | 1049 |
1049 } // namespace net | 1050 } // namespace net |
OLD | NEW |