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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 #include "crypto/scoped_nss_types.h" | 87 #include "crypto/scoped_nss_types.h" |
88 #include "net/base/address_list.h" | 88 #include "net/base/address_list.h" |
89 #include "net/base/connection_type_histograms.h" | 89 #include "net/base/connection_type_histograms.h" |
90 #include "net/base/dns_util.h" | 90 #include "net/base/dns_util.h" |
91 #include "net/base/io_buffer.h" | 91 #include "net/base/io_buffer.h" |
92 #include "net/base/net_errors.h" | 92 #include "net/base/net_errors.h" |
93 #include "net/base/net_log.h" | 93 #include "net/base/net_log.h" |
94 #include "net/cert/asn1_util.h" | 94 #include "net/cert/asn1_util.h" |
95 #include "net/cert/cert_status_flags.h" | 95 #include "net/cert/cert_status_flags.h" |
96 #include "net/cert/cert_verifier.h" | 96 #include "net/cert/cert_verifier.h" |
97 #include "net/cert/ct_objects_extractor.h" | 97 #include "net/cert/ct_ev_whitelist.h" |
98 #include "net/cert/ct_verifier.h" | 98 #include "net/cert/ct_verifier.h" |
99 #include "net/cert/ct_verify_result.h" | 99 #include "net/cert/ct_verify_result.h" |
100 #include "net/cert/scoped_nss_types.h" | 100 #include "net/cert/scoped_nss_types.h" |
101 #include "net/cert/sct_status_flags.h" | 101 #include "net/cert/sct_status_flags.h" |
102 #include "net/cert/single_request_cert_verifier.h" | 102 #include "net/cert/single_request_cert_verifier.h" |
103 #include "net/cert/x509_certificate_net_log_param.h" | 103 #include "net/cert/x509_certificate_net_log_param.h" |
104 #include "net/cert/x509_util.h" | 104 #include "net/cert/x509_util.h" |
105 #include "net/http/transport_security_state.h" | 105 #include "net/http/transport_security_state.h" |
106 #include "net/ocsp/nss_ocsp.h" | 106 #include "net/ocsp/nss_ocsp.h" |
107 #include "net/socket/client_socket_handle.h" | 107 #include "net/socket/client_socket_handle.h" |
(...skipping 3348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3456 (result == OK || | 3456 (result == OK || |
3457 (IsCertificateError(result) && IsCertStatusMinorError(cert_status))) && | 3457 (IsCertificateError(result) && IsCertStatusMinorError(cert_status))) && |
3458 !transport_security_state_->CheckPublicKeyPins( | 3458 !transport_security_state_->CheckPublicKeyPins( |
3459 host_and_port_.host(), | 3459 host_and_port_.host(), |
3460 server_cert_verify_result_.is_issued_by_known_root, | 3460 server_cert_verify_result_.is_issued_by_known_root, |
3461 server_cert_verify_result_.public_key_hashes, | 3461 server_cert_verify_result_.public_key_hashes, |
3462 &pinning_failure_log_)) { | 3462 &pinning_failure_log_)) { |
3463 result = ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN; | 3463 result = ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN; |
3464 } | 3464 } |
3465 | 3465 |
| 3466 scoped_refptr<ct::EVCertsWhitelist> ev_whitelist = |
| 3467 SSLConfigService::GetEVCertsWhitelist(); |
| 3468 if (server_cert_verify_result_.cert_status & CERT_STATUS_IS_EV) { |
| 3469 if (ev_whitelist.get() && ev_whitelist->IsValid()) { |
| 3470 const SHA256HashValue fingerprint( |
| 3471 X509Certificate::CalculateFingerprint256( |
| 3472 server_cert_verify_result_.verified_cert->os_cert_handle())); |
| 3473 |
| 3474 UMA_HISTOGRAM_BOOLEAN( |
| 3475 "Net.SSL_EVCertificateInWhitelist", |
| 3476 ev_whitelist->ContainsCertificateHash( |
| 3477 std::string(reinterpret_cast<const char*>(fingerprint.data), 8))); |
| 3478 } |
| 3479 } |
| 3480 |
3466 if (result == OK) { | 3481 if (result == OK) { |
3467 // Only check Certificate Transparency if there were no other errors with | 3482 // Only check Certificate Transparency if there were no other errors with |
3468 // the connection. | 3483 // the connection. |
3469 VerifyCT(); | 3484 VerifyCT(); |
3470 | 3485 |
3471 // Only cache the session if the certificate verified successfully. | 3486 // Only cache the session if the certificate verified successfully. |
3472 core_->CacheSessionIfNecessary(); | 3487 core_->CacheSessionIfNecessary(); |
3473 } | 3488 } |
3474 | 3489 |
3475 completed_handshake_ = true; | 3490 completed_handshake_ = true; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3563 scoped_refptr<X509Certificate> | 3578 scoped_refptr<X509Certificate> |
3564 SSLClientSocketNSS::GetUnverifiedServerCertificateChain() const { | 3579 SSLClientSocketNSS::GetUnverifiedServerCertificateChain() const { |
3565 return core_->state().server_cert.get(); | 3580 return core_->state().server_cert.get(); |
3566 } | 3581 } |
3567 | 3582 |
3568 ChannelIDService* SSLClientSocketNSS::GetChannelIDService() const { | 3583 ChannelIDService* SSLClientSocketNSS::GetChannelIDService() const { |
3569 return channel_id_service_; | 3584 return channel_id_service_; |
3570 } | 3585 } |
3571 | 3586 |
3572 } // namespace net | 3587 } // namespace net |
OLD | NEW |