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

Side by Side Diff: net/cert/ct_sct_to_string.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: reacted to comments of Charlie and Mike 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "net/cert/ct_sct_to_string.h"
6
7 namespace net {
8
9 namespace ct {
10
11 const std::string HashAlgorithmToString(
12 DigitallySigned::HashAlgorithm hashAlgorithm) {
13 switch (hashAlgorithm) {
14 case DigitallySigned::HASH_ALGO_NONE:
15 return "None / invalid";
16 case DigitallySigned::HASH_ALGO_MD5:
17 return "MD5";
18 case DigitallySigned::HASH_ALGO_SHA1:
19 return "SHA-1";
20 case DigitallySigned::HASH_ALGO_SHA224:
21 return "SHA-224";
22 case DigitallySigned::HASH_ALGO_SHA256:
23 return "SHA-256";
24 case DigitallySigned::HASH_ALGO_SHA384:
25 return "SHA-384";
26 case DigitallySigned::HASH_ALGO_SHA512:
27 return "SHA-512";
28 }
29 return "Unknown";
30 }
31
32 const std::string SignatureAlgorithmToString(
33 DigitallySigned::SignatureAlgorithm signatureAlgorithm) {
34 switch (signatureAlgorithm) {
35 case DigitallySigned::SIG_ALGO_ANONYMOUS:
36 return "Anonymous";
37 case DigitallySigned::SIG_ALGO_RSA:
38 return "RSA";
39 case DigitallySigned::SIG_ALGO_DSA:
40 return "DSA";
41 case DigitallySigned::SIG_ALGO_ECDSA:
42 return "ECDSA";
43 }
44 return "Unknown";
45 }
46
47 const std::string OriginToString(SignedCertificateTimestamp::Origin origin) {
48 switch (origin) {
49 case SignedCertificateTimestamp::SCT_EMBEDDED:
50 return "Embedded in certificate";
51 case SignedCertificateTimestamp::SCT_FROM_TLS_EXTENSION:
52 return "TLS extension";
53 case SignedCertificateTimestamp::SCT_FROM_OCSP_RESPONSE:
54 return "OCSP";
55 case SignedCertificateTimestamp::SCT_ORIGIN_MAX:
56 NOTREACHED();
57 }
58 return "Unknown";
59 }
60
61 const std::string StatusToString(SCTVerifyStatus status) {
62 switch (status) {
63 case SCT_STATUS_LOG_UNKNOWN:
64 return "From unknown log";
65 case SCT_STATUS_INVALID:
66 return "Invalid";
67 case SCT_STATUS_OK:
68 return "Verified";
69 case SCT_STATUS_NONE:
70 return "None";
71 case SCT_STATUS_MAX:
72 NOTREACHED();
73 }
74 return "Unknown";
75 }
76
77 } // namespace ct
78
79 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698