| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/ssl/chrome_security_state_model_client.h" | 5 #include "chrome/browser/ssl/chrome_security_state_model_client.h" |
| 6 | 6 |
| 7 #include <openssl/ssl.h> | 7 #include <openssl/ssl.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 content::WebContents* web_contents = | 170 content::WebContents* web_contents = |
| 171 browser->tab_strip_model()->GetActiveWebContents(); | 171 browser->tab_strip_model()->GetActiveWebContents(); |
| 172 SecurityStateModel::SecurityInfo security_info; | 172 SecurityStateModel::SecurityInfo security_info; |
| 173 ChromeSecurityStateModelClient::FromWebContents(web_contents) | 173 ChromeSecurityStateModelClient::FromWebContents(web_contents) |
| 174 ->GetSecurityInfo(&security_info); | 174 ->GetSecurityInfo(&security_info); |
| 175 | 175 |
| 176 const char *protocol, *key_exchange, *cipher, *mac; | 176 const char *protocol, *key_exchange, *cipher, *mac; |
| 177 int ssl_version = | 177 int ssl_version = |
| 178 net::SSLConnectionStatusToVersion(security_info.connection_status); | 178 net::SSLConnectionStatusToVersion(security_info.connection_status); |
| 179 net::SSLVersionToString(&protocol, ssl_version); | 179 net::SSLVersionToString(&protocol, ssl_version); |
| 180 bool is_aead, is_tls13; | 180 bool is_aead; |
| 181 uint16_t cipher_suite = | 181 uint16_t cipher_suite = |
| 182 net::SSLConnectionStatusToCipherSuite(security_info.connection_status); | 182 net::SSLConnectionStatusToCipherSuite(security_info.connection_status); |
| 183 net::SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, | 183 net::SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, |
| 184 &is_tls13, cipher_suite); | 184 cipher_suite); |
| 185 EXPECT_TRUE(is_aead); | 185 EXPECT_TRUE(is_aead); |
| 186 EXPECT_EQ(nullptr, mac); // The default secure cipher does not have a MAC. | 186 EXPECT_EQ(NULL, mac); // The default secure cipher does not have a MAC. |
| 187 EXPECT_FALSE(is_tls13); // The default secure cipher is not TLS 1.3. | |
| 188 | 187 |
| 189 base::string16 key_exchange_name = base::ASCIIToUTF16(key_exchange); | 188 base::string16 key_exchange_name = base::ASCIIToUTF16(key_exchange); |
| 190 if (security_info.key_exchange_group != 0) { | 189 if (security_info.key_exchange_group != 0) { |
| 191 key_exchange_name = l10n_util::GetStringFUTF16( | 190 key_exchange_name = l10n_util::GetStringFUTF16( |
| 192 IDS_SSL_KEY_EXCHANGE_WITH_GROUP, key_exchange_name, | 191 IDS_SSL_KEY_EXCHANGE_WITH_GROUP, key_exchange_name, |
| 193 base::ASCIIToUTF16( | 192 base::ASCIIToUTF16( |
| 194 SSL_get_curve_name(security_info.key_exchange_group))); | 193 SSL_get_curve_name(security_info.key_exchange_group))); |
| 195 } | 194 } |
| 196 | 195 |
| 197 std::vector<base::string16> description_replacements; | 196 std::vector<base::string16> description_replacements; |
| (...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1669 ChromeSecurityStateModelClient* model_client = | 1668 ChromeSecurityStateModelClient* model_client = |
| 1670 ChromeSecurityStateModelClient::FromWebContents(web_contents); | 1669 ChromeSecurityStateModelClient::FromWebContents(web_contents); |
| 1671 ASSERT_TRUE(model_client); | 1670 ASSERT_TRUE(model_client); |
| 1672 SecurityStateModel::SecurityInfo security_info; | 1671 SecurityStateModel::SecurityInfo security_info; |
| 1673 model_client->GetSecurityInfo(&security_info); | 1672 model_client->GetSecurityInfo(&security_info); |
| 1674 EXPECT_EQ(SecurityStateModel::SECURE, security_info.security_level); | 1673 EXPECT_EQ(SecurityStateModel::SECURE, security_info.security_level); |
| 1675 EXPECT_EQ(kTestSCTStatuses, security_info.sct_verify_statuses); | 1674 EXPECT_EQ(kTestSCTStatuses, security_info.sct_verify_statuses); |
| 1676 } | 1675 } |
| 1677 | 1676 |
| 1678 } // namespace | 1677 } // namespace |
| OLD | NEW |