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

Unified Diff: net/cert/ct_signed_certificate_timestamp_log_param.cc

Issue 1772603002: Addition of Certificate Transparency details to Security panel of DevTools (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed NetLog token Created 4 years, 6 months 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
Index: net/cert/ct_signed_certificate_timestamp_log_param.cc
diff --git a/net/cert/ct_signed_certificate_timestamp_log_param.cc b/net/cert/ct_signed_certificate_timestamp_log_param.cc
index 6d5b864a3b28923344f2480abae7f22b0f42c4f3..d3a2f09516b019b6a181c687117bd141303568c1 100644
--- a/net/cert/ct_signed_certificate_timestamp_log_param.cc
+++ b/net/cert/ct_signed_certificate_timestamp_log_param.cc
@@ -13,6 +13,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
+#include "net/cert/ct_sct_to_string.h"
#include "net/cert/ct_verify_result.h"
#include "net/cert/signed_certificate_timestamp.h"
@@ -20,62 +21,6 @@ namespace net {
namespace {
-// Converts a numeric |origin| to text describing the SCT's origin
-const char* OriginToString(ct::SignedCertificateTimestamp::Origin origin) {
- switch (origin) {
- case ct::SignedCertificateTimestamp::SCT_EMBEDDED:
- return "embedded_in_certificate";
- case ct::SignedCertificateTimestamp::SCT_FROM_TLS_EXTENSION:
- return "tls_extension";
- case ct::SignedCertificateTimestamp::SCT_FROM_OCSP_RESPONSE:
- return "ocsp";
- case ct::SignedCertificateTimestamp::SCT_ORIGIN_MAX:
- break;
- }
-
- return "unknown";
-}
-
-// Converts a numeric |hash_algorithm| to its textual representation
-const char* HashAlgorithmToString(
- ct::DigitallySigned::HashAlgorithm hash_algorithm) {
- switch (hash_algorithm) {
- case ct::DigitallySigned::HASH_ALGO_NONE:
- return "NONE";
- case ct::DigitallySigned::HASH_ALGO_MD5:
- return "MD5";
- case ct::DigitallySigned::HASH_ALGO_SHA1:
- return "SHA1";
- case ct::DigitallySigned::HASH_ALGO_SHA224:
- return "SHA224";
- case ct::DigitallySigned::HASH_ALGO_SHA256:
- return "SHA256";
- case ct::DigitallySigned::HASH_ALGO_SHA384:
- return "SHA384";
- case ct::DigitallySigned::HASH_ALGO_SHA512:
- return "SHA512";
- }
-
- return "unknown";
-}
-
-// Converts a numeric |signature_algorithm| to its textual representation
-const char* SignatureAlgorithmToString(
- ct::DigitallySigned::SignatureAlgorithm signature_algorithm) {
- switch (signature_algorithm) {
- case ct::DigitallySigned::SIG_ALGO_ANONYMOUS:
- return "ANONYMOUS";
- case ct::DigitallySigned::SIG_ALGO_RSA:
- return "RSA";
- case ct::DigitallySigned::SIG_ALGO_DSA:
- return "DSA";
- case ct::DigitallySigned::SIG_ALGO_ECDSA:
- return "ECDSA";
- }
-
- return "unknown";
-}
-
// Base64 encode the given |value| string and put it in |dict| with the
// description |key|.
void SetBinaryData(
@@ -95,7 +40,14 @@ std::unique_ptr<base::DictionaryValue> SCTToDictionary(
const ct::SignedCertificateTimestamp& sct) {
std::unique_ptr<base::DictionaryValue> out(new base::DictionaryValue());
- out->SetString("origin", OriginToString(sct.origin));
+ // Transform capital letters to lowercase, and replace spaces with underscores
+ // to conform with SIGNED_CERTIFICATE_TIMESTAMPS_CHECKED in
+ // net/log/net_log_event_type_list.h.
+ std::string origin = OriginToString(sct.origin);
+ std::transform(origin.begin(), origin.end(), origin.begin(), ::tolower);
+ std::replace(origin.begin(), origin.end(), ' ', '_');
+ out->SetString("origin", origin);
davidben 2016/06/14 15:47:37 I suppose this is fine, but you also may as well j
dwaxweiler 2016/06/14 16:57:02 At least one check of the tests in net/cert/multi_
davidben 2016/06/14 18:39:26 *shrug* I have a minor preference for updating the
+
out->SetInteger("version", sct.version);
SetBinaryData("log_id", sct.log_id, out.get());
« net/cert/ct_sct_to_string.cc ('K') | « net/cert/ct_sct_to_string.cc ('k') | net/net.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698