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 <cert.h> | 5 #include <cert.h> |
6 #include <cryptohi.h> | 6 #include <cryptohi.h> |
7 #include <keyhi.h> | 7 #include <keyhi.h> |
8 #include <nss.h> | 8 #include <nss.h> |
9 #include <pk11pub.h> | 9 #include <pk11pub.h> |
10 #include <prtime.h> | 10 #include <prtime.h> |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 case SERVER_CERT: | 81 case SERVER_CERT: |
82 result = subject_.GetDisplayName(); | 82 result = subject_.GetDisplayName(); |
83 break; | 83 break; |
84 case OTHER_CERT: | 84 case OTHER_CERT: |
85 default: | 85 default: |
86 break; | 86 break; |
87 } | 87 } |
88 return result; | 88 return result; |
89 } | 89 } |
90 | 90 |
91 void X509Certificate::GetSubjectAltName( | 91 bool X509Certificate::GetSubjectAltName( |
92 std::vector<std::string>* dns_names, | 92 std::vector<std::string>* dns_names, |
93 std::vector<std::string>* ip_addrs) const { | 93 std::vector<std::string>* ip_addrs) const { |
94 x509_util::GetSubjectAltName(cert_handle_, dns_names, ip_addrs); | 94 return x509_util::GetSubjectAltName(cert_handle_, dns_names, ip_addrs); |
95 } | 95 } |
96 | 96 |
97 bool X509Certificate::IsIssuedByEncoded( | 97 bool X509Certificate::IsIssuedByEncoded( |
98 const std::vector<std::string>& valid_issuers) { | 98 const std::vector<std::string>& valid_issuers) { |
99 // Get certificate chain as scoped list of CERTCertificate objects. | 99 // Get certificate chain as scoped list of CERTCertificate objects. |
100 std::vector<CERTCertificate*> cert_chain; | 100 std::vector<CERTCertificate*> cert_chain; |
101 cert_chain.push_back(cert_handle_); | 101 cert_chain.push_back(cert_handle_); |
102 for (size_t n = 0; n < intermediate_ca_certs_.size(); ++n) { | 102 for (size_t n = 0; n < intermediate_ca_certs_.size(); ++n) { |
103 cert_chain.push_back(intermediate_ca_certs_[n]); | 103 cert_chain.push_back(intermediate_ca_certs_[n]); |
104 } | 104 } |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 return false; | 245 return false; |
246 if (SECSuccess != CERT_VerifySignedDataWithPublicKey( | 246 if (SECSuccess != CERT_VerifySignedDataWithPublicKey( |
247 &cert_handle->signatureWrap, public_key.get(), NULL)) { | 247 &cert_handle->signatureWrap, public_key.get(), NULL)) { |
248 return false; | 248 return false; |
249 } | 249 } |
250 return CERT_CompareName(&cert_handle->subject, &cert_handle->issuer) == | 250 return CERT_CompareName(&cert_handle->subject, &cert_handle->issuer) == |
251 SECEqual; | 251 SECEqual; |
252 } | 252 } |
253 | 253 |
254 } // namespace net | 254 } // namespace net |
OLD | NEW |