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 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived | 5 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived |
6 // from AuthCertificateCallback() in | 6 // from AuthCertificateCallback() in |
7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp. | 7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp. |
8 | 8 |
9 /* ***** BEGIN LICENSE BLOCK ***** | 9 /* ***** BEGIN LICENSE BLOCK ***** |
10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 #include "crypto/scoped_nss_types.h" | 86 #include "crypto/scoped_nss_types.h" |
87 #include "net/base/address_list.h" | 87 #include "net/base/address_list.h" |
88 #include "net/base/connection_type_histograms.h" | 88 #include "net/base/connection_type_histograms.h" |
89 #include "net/base/dns_util.h" | 89 #include "net/base/dns_util.h" |
90 #include "net/base/io_buffer.h" | 90 #include "net/base/io_buffer.h" |
91 #include "net/base/net_errors.h" | 91 #include "net/base/net_errors.h" |
92 #include "net/base/net_log.h" | 92 #include "net/base/net_log.h" |
93 #include "net/cert/asn1_util.h" | 93 #include "net/cert/asn1_util.h" |
94 #include "net/cert/cert_status_flags.h" | 94 #include "net/cert/cert_status_flags.h" |
95 #include "net/cert/cert_verifier.h" | 95 #include "net/cert/cert_verifier.h" |
96 #include "net/cert/ct_ev_whitelist.h" | |
97 #include "net/cert/ct_objects_extractor.h" | 96 #include "net/cert/ct_objects_extractor.h" |
98 #include "net/cert/ct_verifier.h" | 97 #include "net/cert/ct_verifier.h" |
99 #include "net/cert/ct_verify_result.h" | 98 #include "net/cert/ct_verify_result.h" |
100 #include "net/cert/scoped_nss_types.h" | 99 #include "net/cert/scoped_nss_types.h" |
101 #include "net/cert/sct_status_flags.h" | 100 #include "net/cert/sct_status_flags.h" |
102 #include "net/cert/single_request_cert_verifier.h" | 101 #include "net/cert/single_request_cert_verifier.h" |
103 #include "net/cert/x509_certificate_net_log_param.h" | 102 #include "net/cert/x509_certificate_net_log_param.h" |
104 #include "net/cert/x509_util.h" | 103 #include "net/cert/x509_util.h" |
105 #include "net/http/transport_security_state.h" | 104 #include "net/http/transport_security_state.h" |
106 #include "net/ocsp/nss_ocsp.h" | 105 #include "net/ocsp/nss_ocsp.h" |
(...skipping 3313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3420 (IsCertificateError(result) && IsCertStatusMinorError(cert_status))) && | 3419 (IsCertificateError(result) && IsCertStatusMinorError(cert_status))) && |
3421 !transport_security_state_->CheckPublicKeyPins( | 3420 !transport_security_state_->CheckPublicKeyPins( |
3422 host_and_port_.host(), | 3421 host_and_port_.host(), |
3423 sni_available, | 3422 sni_available, |
3424 server_cert_verify_result_.is_issued_by_known_root, | 3423 server_cert_verify_result_.is_issued_by_known_root, |
3425 server_cert_verify_result_.public_key_hashes, | 3424 server_cert_verify_result_.public_key_hashes, |
3426 &pinning_failure_log_)) { | 3425 &pinning_failure_log_)) { |
3427 result = ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN; | 3426 result = ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN; |
3428 } | 3427 } |
3429 | 3428 |
3430 if (server_cert_verify_result_.cert_status & CERT_STATUS_IS_EV && | |
3431 ct::HasValidEVWhitelist()) { | |
3432 const SHA256HashValue fingerprint(X509Certificate::CalculateFingerprint256( | |
3433 server_cert_verify_result_.verified_cert->os_cert_handle())); | |
3434 | |
3435 UMA_HISTOGRAM_BOOLEAN( | |
3436 "Net.SSL_EVCertificateInWhitelist", | |
3437 ct::IsCertificateHashInWhitelist( | |
3438 std::string(reinterpret_cast<const char*>(fingerprint.data), 8))); | |
3439 } | |
3440 | |
3441 if (result == OK) { | 3429 if (result == OK) { |
3442 // Only check Certificate Transparency if there were no other errors with | 3430 // Only check Certificate Transparency if there were no other errors with |
3443 // the connection. | 3431 // the connection. |
3444 VerifyCT(); | 3432 VerifyCT(); |
3445 | 3433 |
3446 // Only cache the session if the certificate verified successfully. | 3434 // Only cache the session if the certificate verified successfully. |
3447 core_->CacheSessionIfNecessary(); | 3435 core_->CacheSessionIfNecessary(); |
3448 } | 3436 } |
3449 | 3437 |
3450 completed_handshake_ = true; | 3438 completed_handshake_ = true; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3538 scoped_refptr<X509Certificate> | 3526 scoped_refptr<X509Certificate> |
3539 SSLClientSocketNSS::GetUnverifiedServerCertificateChain() const { | 3527 SSLClientSocketNSS::GetUnverifiedServerCertificateChain() const { |
3540 return core_->state().server_cert.get(); | 3528 return core_->state().server_cert.get(); |
3541 } | 3529 } |
3542 | 3530 |
3543 ChannelIDService* SSLClientSocketNSS::GetChannelIDService() const { | 3531 ChannelIDService* SSLClientSocketNSS::GetChannelIDService() const { |
3544 return channel_id_service_; | 3532 return channel_id_service_; |
3545 } | 3533 } |
3546 | 3534 |
3547 } // namespace net | 3535 } // namespace net |
OLD | NEW |