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

Side by Side Diff: net/cert/signed_certificate_timestamp.h

Issue 37633002: CT: First step towards supporting Certificate Transparency in Chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implementing Ryan's suggestion of substr-ing the StringPiece Created 7 years, 1 month 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
« no previous file with comments | « net/cert/ct_serialization_unittest.cc ('k') | net/cert/signed_certificate_timestamp.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 #ifndef NET_CERT_SIGNED_CERTIFICATE_TIMESTAMP_H_
6 #define NET_CERT_SIGNED_CERTIFICATE_TIMESTAMP_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/time/time.h"
12 #include "net/base/hash_value.h"
13 #include "net/base/net_export.h"
14
15 namespace net {
16
17 // Structures related to Certificate Transparency (RFC6962).
18 namespace ct {
19
20 // LogEntry struct in RFC 6962, Section 3.1
21 struct NET_EXPORT LogEntry {
22 // LogEntryType enum in RFC 6962, Section 3.1
23 enum Type {
24 LOG_ENTRY_TYPE_X509 = 0,
25 LOG_ENTRY_TYPE_PRECERT = 1
26 };
27
28 LogEntry();
29 ~LogEntry();
30 void Reset();
31
32 Type type;
33
34 // Set if type == LOG_ENTRY_TYPE_X509
35 std::string leaf_certificate;
36
37 // Set if type == LOG_ENTRY_TYPE_PRECERT
38 SHA256HashValue issuer_key_hash;
39 std::string tbs_certificate;
40 };
41
42 // Helper structure to represent Digitally Signed data, as described in
43 // Sections 4.7 and 7.4.1.4.1 of RFC 5246.
44 struct NET_EXPORT_PRIVATE DigitallySigned {
45 enum HashAlgorithm {
46 HASH_ALGO_NONE = 0,
47 HASH_ALGO_MD5 = 1,
48 HASH_ALGO_SHA1 = 2,
49 HASH_ALGO_SHA224 = 3,
50 HASH_ALGO_SHA256 = 4,
51 HASH_ALGO_SHA384 = 5,
52 HASH_ALGO_SHA512 = 6,
53 };
54
55 enum SignatureAlgorithm {
56 SIG_ALGO_ANONYMOUS = 0,
57 SIG_ALGO_RSA = 1,
58 SIG_ALGO_DSA = 2,
59 SIG_ALGO_ECDSA = 3
60 };
61
62 DigitallySigned();
63 ~DigitallySigned();
64
65 HashAlgorithm hash_algorithm;
66 SignatureAlgorithm signature_algorithm;
67 // 'signature' field.
68 std::string signature_data;
69 };
70
71 // SignedCertificateTimestamp struct in RFC 6962, Section 3.2.
72 struct NET_EXPORT SignedCertificateTimestamp {
73 // Version enum in RFC 6962, Section 3.2.
74 enum Version {
75 SCT_VERSION_1 = 0,
76 };
77
78 // Source of the SCT - supplementary, not defined in CT RFC.
79 enum Origin {
80 SCT_EMBEDDED = 0,
81 SCT_FROM_TLS_HANDSHAKE = 1,
82 SCT_FROM_OCSP_RESPONSE = 2,
83 };
84
85 SignedCertificateTimestamp();
86 ~SignedCertificateTimestamp();
87
88 Version version;
89 std::string log_id;
90 base::Time timestamp;
91 std::string extensions;
92 DigitallySigned signature;
93 // The origin should not participate in equality checks
94 // as the same SCT can be provided from multiple sources.
95 Origin origin;
96 };
97
98 } // namespace ct
99
100 } // namespace net
101
102 #endif // NET_CERT_SIGNED_CERTIFICATE_TIMESTAMP_H_
OLDNEW
« no previous file with comments | « net/cert/ct_serialization_unittest.cc ('k') | net/cert/signed_certificate_timestamp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698