| 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 #define PRArenaPool PLArenaPool // Required by <blapi.h>. | 7 #define PRArenaPool PLArenaPool // Required by <blapi.h>. |
| 8 #include <blapi.h> // Implement CalculateChainFingerprint() with NSS. | 8 #include <blapi.h> // Implement CalculateChainFingerprint() with NSS. |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 return MapCertStatusToNetError(verify_result->cert_status); | 902 return MapCertStatusToNetError(verify_result->cert_status); |
| 903 | 903 |
| 904 AppendPublicKeyHashes(chain_context, &verify_result->public_key_hashes); | 904 AppendPublicKeyHashes(chain_context, &verify_result->public_key_hashes); |
| 905 verify_result->is_issued_by_known_root = IsIssuedByKnownRoot(chain_context); | 905 verify_result->is_issued_by_known_root = IsIssuedByKnownRoot(chain_context); |
| 906 | 906 |
| 907 if (ev_policy_oid && CheckEV(chain_context, ev_policy_oid)) | 907 if (ev_policy_oid && CheckEV(chain_context, ev_policy_oid)) |
| 908 verify_result->cert_status |= CERT_STATUS_IS_EV; | 908 verify_result->cert_status |= CERT_STATUS_IS_EV; |
| 909 return OK; | 909 return OK; |
| 910 } | 910 } |
| 911 | 911 |
| 912 bool X509Certificate::GetDEREncoded(std::string* encoded) { | 912 // static |
| 913 if (!cert_handle_->pbCertEncoded || !cert_handle_->cbCertEncoded) | 913 bool X509Certificate::GetDEREncoded(X509Certificate::OSCertHandle cert_handle, |
| 914 std::string* encoded) { |
| 915 if (!cert_handle->pbCertEncoded || !cert_handle->cbCertEncoded) |
| 914 return false; | 916 return false; |
| 915 encoded->clear(); | 917 encoded->assign(reinterpret_cast<char*>(cert_handle->pbCertEncoded), |
| 916 encoded->append(reinterpret_cast<char*>(cert_handle_->pbCertEncoded), | 918 cert_handle->cbCertEncoded); |
| 917 cert_handle_->cbCertEncoded); | |
| 918 return true; | 919 return true; |
| 919 } | 920 } |
| 920 | 921 |
| 921 // Returns true if the certificate is an extended-validation certificate. | 922 // Returns true if the certificate is an extended-validation certificate. |
| 922 // | 923 // |
| 923 // This function checks the certificatePolicies extensions of the | 924 // This function checks the certificatePolicies extensions of the |
| 924 // certificates in the certificate chain according to Section 7 (pp. 11-12) | 925 // certificates in the certificate chain according to Section 7 (pp. 11-12) |
| 925 // of the EV Certificate Guidelines Version 1.0 at | 926 // of the EV Certificate Guidelines Version 1.0 at |
| 926 // http://cabforum.org/EV_Certificate_Guidelines.pdf. | 927 // http://cabforum.org/EV_Certificate_Guidelines.pdf. |
| 927 bool X509Certificate::CheckEV(PCCERT_CHAIN_CONTEXT chain_context, | 928 bool X509Certificate::CheckEV(PCCERT_CHAIN_CONTEXT chain_context, |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 if (!CertSerializeCertificateStoreElement(cert_handle, 0, &buffer[0], | 1081 if (!CertSerializeCertificateStoreElement(cert_handle, 0, &buffer[0], |
| 1081 &length)) { | 1082 &length)) { |
| 1082 return false; | 1083 return false; |
| 1083 } | 1084 } |
| 1084 | 1085 |
| 1085 return pickle->WriteData(reinterpret_cast<const char*>(&buffer[0]), | 1086 return pickle->WriteData(reinterpret_cast<const char*>(&buffer[0]), |
| 1086 length); | 1087 length); |
| 1087 } | 1088 } |
| 1088 | 1089 |
| 1089 } // namespace net | 1090 } // namespace net |
| OLD | NEW |