| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <CommonCrypto/CommonDigest.h> | 7 #include <CommonCrypto/CommonDigest.h> |
| 8 #include <time.h> | 8 #include <time.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/pickle.h" | 11 #include "base/pickle.h" |
| 12 #include "net/base/cert_status_flags.h" | 12 #include "net/base/cert_status_flags.h" |
| 13 #include "net/base/ev_root_ca_metadata.h" | 13 #include "net/base/ev_root_ca_metadata.h" |
| 14 #include "net/base/net_errors.h" |
| 14 | 15 |
| 15 using base::Time; | 16 using base::Time; |
| 16 | 17 |
| 17 namespace net { | 18 namespace net { |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 inline bool CSSMOIDEqual(const CSSM_OID* oid1, const CSSM_OID* oid2) { | 22 inline bool CSSMOIDEqual(const CSSM_OID* oid1, const CSSM_OID* oid2) { |
| 22 return oid1->Length == oid2->Length && | 23 return oid1->Length == oid2->Length && |
| 23 (memcmp(oid1->Data, oid2->Data, oid1->Length) == 0); | 24 (memcmp(oid1->Data, oid2->Data, oid1->Length) == 0); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 245 |
| 245 void X509Certificate::GetDNSNames(std::vector<std::string>* dns_names) const { | 246 void X509Certificate::GetDNSNames(std::vector<std::string>* dns_names) const { |
| 246 dns_names->clear(); | 247 dns_names->clear(); |
| 247 | 248 |
| 248 GetCertGeneralNamesForOID(cert_handle_, CSSMOID_SubjectAltName, GNT_DNSName, | 249 GetCertGeneralNamesForOID(cert_handle_, CSSMOID_SubjectAltName, GNT_DNSName, |
| 249 dns_names); | 250 dns_names); |
| 250 | 251 |
| 251 if (dns_names->empty()) | 252 if (dns_names->empty()) |
| 252 dns_names->push_back(subject_.common_name); | 253 dns_names->push_back(subject_.common_name); |
| 253 } | 254 } |
| 255 |
| 256 int X509Certificate::Verify(const std::string& hostname, |
| 257 bool rev_checking_enabled, |
| 258 CertVerifyResult* verify_result) const { |
| 259 NOTIMPLEMENTED(); |
| 260 return ERR_NOT_IMPLEMENTED; |
| 261 } |
| 254 | 262 |
| 255 // Returns true if the certificate is an extended-validation certificate. | 263 // Returns true if the certificate is an extended-validation certificate. |
| 256 // | 264 // |
| 257 // The certificate has already been verified by the HTTP library. cert_status | 265 // The certificate has already been verified by the HTTP library. cert_status |
| 258 // represents the result of that verification. This function performs | 266 // represents the result of that verification. This function performs |
| 259 // additional checks of the certificatePolicies extensions of the certificates | 267 // additional checks of the certificatePolicies extensions of the certificates |
| 260 // in the certificate chain according to Section 7 (pp. 11-12) of the EV | 268 // in the certificate chain according to Section 7 (pp. 11-12) of the EV |
| 261 // Certificate Guidelines Version 1.0 at | 269 // Certificate Guidelines Version 1.0 at |
| 262 // http://cabforum.org/EV_Certificate_Guidelines.pdf. | 270 // http://cabforum.org/EV_Certificate_Guidelines.pdf. |
| 263 bool X509Certificate::IsEV(int cert_status) const { | 271 bool X509Certificate::IsEV(int cert_status) const { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 | 310 |
| 303 DCHECK(NULL != cert_data.Data); | 311 DCHECK(NULL != cert_data.Data); |
| 304 DCHECK(0 != cert_data.Length); | 312 DCHECK(0 != cert_data.Length); |
| 305 | 313 |
| 306 CC_SHA1(cert_data.Data, cert_data.Length, sha1.data); | 314 CC_SHA1(cert_data.Data, cert_data.Length, sha1.data); |
| 307 | 315 |
| 308 return sha1; | 316 return sha1; |
| 309 } | 317 } |
| 310 | 318 |
| 311 } // namespace net | 319 } // namespace net |
| OLD | NEW |