Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2468)

Unified Diff: net/ssl/ssl_cipher_suite_names.cc

Issue 2156763003: Extend the webRequest.onCompleted event details object with TLS/SSL information Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Trim more fields and use composed cipher suite name Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/ssl/ssl_cipher_suite_names.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ssl/ssl_cipher_suite_names.cc
diff --git a/net/ssl/ssl_cipher_suite_names.cc b/net/ssl/ssl_cipher_suite_names.cc
index 320c22e1f3c02ce0d5a85e4f42cc7a5d15d331b6..3e3e46faf4eea9695fb44e873642885951f8f423 100644
--- a/net/ssl/ssl_cipher_suite_names.cc
+++ b/net/ssl/ssl_cipher_suite_names.cc
@@ -9,6 +9,7 @@
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
+#include "base/strings/stringprintf.h"
#include "net/ssl/ssl_connection_status_flags.h"
#include "third_party/boringssl/src/include/openssl/ssl.h"
@@ -384,6 +385,47 @@ void SSLCipherSuiteToStrings(const char** key_exchange_str,
}
}
+std::string SSLCipherSuiteToComposedString(uint16_t cipher_suite) {
+ int key_exchange, cipher, mac;
+ if (!GetCipherProperties(cipher_suite, &key_exchange, &cipher, &mac))
+ return "UNKNOWN";
+
+ const char* prf;
+ switch (mac) {
+ case 1:
+ prf = "MD5";
+ break;
+ case 2:
+ prf = "SHA";
+ break;
+ case 3:
+ prf = "SHA256";
+ break;
+ case 4:
+ prf = "SHA384";
+ break;
+ case 7: // kAEADMACValue
+ if (cipher == 14 || cipher == 9) { // AES_256_GCM or AES_256_CBC
+ prf = "SHA384";
+ break;
+ }
+ prf = "SHA256";
+ break;
+ default:
+ NOTREACHED() << mac;
+ prf = "???";
+ break;
+ }
+
+ std::string composed = "TLS";
+ if (key_exchange != kTLS13KeyExchangeValue)
+ composed +=
+ base::StringPrintf("_%s_WITH", kKeyExchangeNames[key_exchange].name);
+ composed += base::StringPrintf("_%s_%s", kCipherNames[cipher].name, prf);
+
+ return composed;
+}
davidben 2016/12/07 15:31:45 I haven't looked at the rest yet, but the whole po
+
void SSLVersionToString(const char** name, int ssl_version) {
switch (ssl_version) {
case SSL_CONNECTION_VERSION_SSL2:
« no previous file with comments | « net/ssl/ssl_cipher_suite_names.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698