 Chromium Code Reviews
 Chromium Code Reviews Issue 2951043002:
  Prepare security bullets for Android: add issuer and change connection details.  (Closed)
    
  
    Issue 2951043002:
  Prepare security bullets for Android: add issuer and change connection details.  (Closed) 
  | OLD | NEW | 
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/security_state/content/content_utils.h" | 5 #include "components/security_state/content/content_utils.h" | 
| 6 | 6 | 
| 7 #include <string> | 7 #include <string> | 
| 8 #include <vector> | 8 #include <vector> | 
| 9 | 9 | 
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" | 
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 return; | 105 return; | 
| 106 } | 106 } | 
| 107 | 107 | 
| 108 std::vector<base::string16> description_replacements; | 108 std::vector<base::string16> description_replacements; | 
| 109 int status = security_info.obsolete_ssl_status; | 109 int status = security_info.obsolete_ssl_status; | 
| 110 int str_id; | 110 int str_id; | 
| 111 | 111 | 
| 112 str_id = (status & net::OBSOLETE_SSL_MASK_PROTOCOL) | 112 str_id = (status & net::OBSOLETE_SSL_MASK_PROTOCOL) | 
| 113 ? IDS_SSL_AN_OBSOLETE_PROTOCOL | 113 ? IDS_SSL_AN_OBSOLETE_PROTOCOL | 
| 114 : IDS_SSL_A_STRONG_PROTOCOL; | 114 : IDS_SSL_A_STRONG_PROTOCOL; | 
| 115 description_replacements.push_back(protocol_name); | |
| 115 description_replacements.push_back(l10n_util::GetStringUTF16(str_id)); | 116 description_replacements.push_back(l10n_util::GetStringUTF16(str_id)); | 
| 116 description_replacements.push_back(protocol_name); | |
| 117 | 117 | 
| 118 str_id = (status & net::OBSOLETE_SSL_MASK_KEY_EXCHANGE) | 118 str_id = (status & net::OBSOLETE_SSL_MASK_KEY_EXCHANGE) | 
| 119 ? IDS_SSL_AN_OBSOLETE_KEY_EXCHANGE | 119 ? IDS_SSL_AN_OBSOLETE_KEY_EXCHANGE | 
| 120 : IDS_SSL_A_STRONG_KEY_EXCHANGE; | 120 : IDS_SSL_A_STRONG_KEY_EXCHANGE; | 
| 121 description_replacements.push_back(key_exchange_name); | |
| 121 description_replacements.push_back(l10n_util::GetStringUTF16(str_id)); | 122 description_replacements.push_back(l10n_util::GetStringUTF16(str_id)); | 
| 122 description_replacements.push_back(key_exchange_name); | |
| 123 | 123 | 
| 124 str_id = (status & net::OBSOLETE_SSL_MASK_CIPHER) ? IDS_SSL_AN_OBSOLETE_CIPHER | 124 str_id = (status & net::OBSOLETE_SSL_MASK_CIPHER) ? IDS_SSL_AN_OBSOLETE_CIPHER | 
| 125 : IDS_SSL_A_STRONG_CIPHER; | 125 : IDS_SSL_A_STRONG_CIPHER; | 
| 126 description_replacements.push_back(cipher_name); | |
| 126 description_replacements.push_back(l10n_util::GetStringUTF16(str_id)); | 127 description_replacements.push_back(l10n_util::GetStringUTF16(str_id)); | 
| 127 description_replacements.push_back(cipher_name); | |
| 128 | 128 | 
| 129 security_style_explanations->info_explanations.push_back( | 129 security_style_explanations->info_explanations.push_back( | 
| 130 content::SecurityStyleExplanation( | 130 content::SecurityStyleExplanation( | 
| 131 l10n_util::GetStringUTF8(IDS_OBSOLETE_SSL_SUMMARY), | 131 l10n_util::GetStringUTF8(IDS_OBSOLETE_SSL_SUMMARY), | 
| 132 base::UTF16ToUTF8( | 132 base::UTF16ToUTF8( | 
| 133 l10n_util::GetStringFUTF16(IDS_OBSOLETE_SSL_DESCRIPTION, | 133 l10n_util::GetStringFUTF16(IDS_OBSOLETE_SSL_DESCRIPTION, | 
| 134 description_replacements, nullptr)))); | 134 description_replacements, nullptr)))); | 
| 135 } | 135 } | 
| 136 | 136 | 
| 137 } // namespace | 137 } // namespace | 
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 290 !!security_info.certificate); | 290 !!security_info.certificate); | 
| 291 | 291 | 
| 292 if (is_cert_status_minor_error) { | 292 if (is_cert_status_minor_error) { | 
| 293 security_style_explanations->neutral_explanations.push_back(explanation); | 293 security_style_explanations->neutral_explanations.push_back(explanation); | 
| 294 } else { | 294 } else { | 
| 295 security_style_explanations->insecure_explanations.push_back(explanation); | 295 security_style_explanations->insecure_explanations.push_back(explanation); | 
| 296 } | 296 } | 
| 297 } else { | 297 } else { | 
| 298 // If the certificate does not have errors and is not using SHA1, then add | 298 // If the certificate does not have errors and is not using SHA1, then add | 
| 299 // an explanation that the certificate is valid. | 299 // an explanation that the certificate is valid. | 
| 300 | |
| 301 base::string16 issuer_name; | |
| 302 if (security_info.certificate) { | |
| 303 issuer_name = base::UTF8ToUTF16( | |
| 304 security_info.certificate->issuer().GetDisplayName()); | |
| 305 } else { | |
| 306 issuer_name = base::string16(); | |
| 307 } | |
| 308 if (issuer_name.empty()) { | |
| 309 issuer_name.assign( | |
| 310 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); | |
| 
estark
2017/06/21 16:47:51
Took me a minute to understand why this can't just
 
lgarron
2017/06/22 00:48:05
Will do.
 | |
| 311 } | |
| 312 | |
| 300 if (!security_info.sha1_in_chain) { | 313 if (!security_info.sha1_in_chain) { | 
| 301 security_style_explanations->secure_explanations.push_back( | 314 security_style_explanations->secure_explanations.push_back( | 
| 302 content::SecurityStyleExplanation( | 315 content::SecurityStyleExplanation( | 
| 303 l10n_util::GetStringUTF8(IDS_VALID_SERVER_CERTIFICATE), | 316 l10n_util::GetStringUTF8(IDS_VALID_SERVER_CERTIFICATE), | 
| 304 l10n_util::GetStringUTF8( | 317 l10n_util::GetStringFUTF8( | 
| 305 IDS_VALID_SERVER_CERTIFICATE_DESCRIPTION), | 318 IDS_VALID_SERVER_CERTIFICATE_DESCRIPTION, issuer_name), | 
| 306 !!security_info.certificate)); | 319 !!security_info.certificate)); | 
| 307 } | 320 } | 
| 308 } | 321 } | 
| 309 | 322 | 
| 310 AddConnectionExplanation(security_info, security_style_explanations); | 323 AddConnectionExplanation(security_info, security_style_explanations); | 
| 311 | 324 | 
| 312 security_style_explanations->pkp_bypassed = security_info.pkp_bypassed; | 325 security_style_explanations->pkp_bypassed = security_info.pkp_bypassed; | 
| 313 if (security_info.pkp_bypassed) { | 326 if (security_info.pkp_bypassed) { | 
| 314 security_style_explanations->info_explanations.push_back( | 327 security_style_explanations->info_explanations.push_back( | 
| 315 content::SecurityStyleExplanation( | 328 content::SecurityStyleExplanation( | 
| 316 l10n_util::GetStringUTF8(IDS_PRIVATE_KEY_PINNING_BYPASSED), | 329 l10n_util::GetStringUTF8(IDS_PRIVATE_KEY_PINNING_BYPASSED), | 
| 317 l10n_util::GetStringUTF8( | 330 l10n_util::GetStringUTF8( | 
| 318 IDS_PRIVATE_KEY_PINNING_BYPASSED_DESCRIPTION))); | 331 IDS_PRIVATE_KEY_PINNING_BYPASSED_DESCRIPTION))); | 
| 319 } | 332 } | 
| 320 | 333 | 
| 321 return security_style; | 334 return security_style; | 
| 322 } | 335 } | 
| 323 | 336 | 
| 324 } // namespace security_state | 337 } // namespace security_state | 
| OLD | NEW |