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> |
| 8 |
7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
11 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
12 #include "chrome/browser/ssl/cert_verifier_browser_test.h" | 14 #include "chrome/browser/ssl/cert_verifier_browser_test.h" |
13 #include "chrome/browser/ssl/chrome_security_state_model_client.h" | 15 #include "chrome/browser/ssl/chrome_security_state_model_client.h" |
14 #include "chrome/browser/ssl/ssl_blocking_page.h" | 16 #include "chrome/browser/ssl/ssl_blocking_page.h" |
15 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/browser_commands.h" | 18 #include "chrome/browser/ui/browser_commands.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 net::SSLConnectionStatusToVersion(security_info.connection_status); | 177 net::SSLConnectionStatusToVersion(security_info.connection_status); |
176 net::SSLVersionToString(&protocol, ssl_version); | 178 net::SSLVersionToString(&protocol, ssl_version); |
177 bool is_aead; | 179 bool is_aead; |
178 uint16_t cipher_suite = | 180 uint16_t cipher_suite = |
179 net::SSLConnectionStatusToCipherSuite(security_info.connection_status); | 181 net::SSLConnectionStatusToCipherSuite(security_info.connection_status); |
180 net::SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, | 182 net::SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, |
181 cipher_suite); | 183 cipher_suite); |
182 EXPECT_TRUE(is_aead); | 184 EXPECT_TRUE(is_aead); |
183 EXPECT_EQ(NULL, mac); // The default secure cipher does not have a MAC. | 185 EXPECT_EQ(NULL, mac); // The default secure cipher does not have a MAC. |
184 | 186 |
| 187 base::string16 key_exchange_name = base::ASCIIToUTF16(key_exchange); |
| 188 if (security_info.key_exchange_group != 0) { |
| 189 key_exchange_name = l10n_util::GetStringFUTF16( |
| 190 IDS_SSL_KEY_EXCHANGE_WITH_GROUP, key_exchange_name, |
| 191 base::ASCIIToUTF16( |
| 192 SSL_get_curve_name(security_info.key_exchange_group))); |
| 193 } |
| 194 |
185 std::vector<base::string16> description_replacements; | 195 std::vector<base::string16> description_replacements; |
186 description_replacements.push_back(base::ASCIIToUTF16(protocol)); | 196 description_replacements.push_back(base::ASCIIToUTF16(protocol)); |
187 description_replacements.push_back(base::ASCIIToUTF16(key_exchange)); | 197 description_replacements.push_back(key_exchange_name); |
188 description_replacements.push_back(base::ASCIIToUTF16(cipher)); | 198 description_replacements.push_back(base::ASCIIToUTF16(cipher)); |
189 base::string16 secure_description = l10n_util::GetStringFUTF16( | 199 base::string16 secure_description = l10n_util::GetStringFUTF16( |
190 IDS_STRONG_SSL_DESCRIPTION, description_replacements, nullptr); | 200 IDS_STRONG_SSL_DESCRIPTION, description_replacements, nullptr); |
191 | 201 |
192 EXPECT_EQ(secure_description, | 202 EXPECT_EQ(secure_description, |
193 base::ASCIIToUTF16(secure_explanations.back().description)); | 203 base::ASCIIToUTF16(secure_explanations.back().description)); |
194 } | 204 } |
195 | 205 |
196 void CheckSecurityInfoForSecure( | 206 void CheckSecurityInfoForSecure( |
197 content::WebContents* contents, | 207 content::WebContents* contents, |
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1407 ChromeSecurityStateModelClient* model_client = | 1417 ChromeSecurityStateModelClient* model_client = |
1408 ChromeSecurityStateModelClient::FromWebContents(web_contents); | 1418 ChromeSecurityStateModelClient::FromWebContents(web_contents); |
1409 ASSERT_TRUE(model_client); | 1419 ASSERT_TRUE(model_client); |
1410 const SecurityStateModel::SecurityInfo& security_info = | 1420 const SecurityStateModel::SecurityInfo& security_info = |
1411 model_client->GetSecurityInfo(); | 1421 model_client->GetSecurityInfo(); |
1412 EXPECT_EQ(SecurityStateModel::SECURE, security_info.security_level); | 1422 EXPECT_EQ(SecurityStateModel::SECURE, security_info.security_level); |
1413 EXPECT_EQ(kTestSCTStatuses, security_info.sct_verify_statuses); | 1423 EXPECT_EQ(kTestSCTStatuses, security_info.sct_verify_statuses); |
1414 } | 1424 } |
1415 | 1425 |
1416 } // namespace | 1426 } // namespace |
OLD | NEW |