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