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

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

Issue 1943313003: Adds a function for encoding a Merkle tree leaf in TLS wire format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adds tests Created 4 years, 7 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
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 #ifndef NET_CERT_MERKLE_TREE_LEAF_H_ 5 #ifndef NET_CERT_MERKLE_TREE_LEAF_H_
6 #define NET_CERT_MERKLE_TREE_LEAF_H_ 6 #define NET_CERT_MERKLE_TREE_LEAF_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "net/base/net_export.h" 12 #include "net/base/net_export.h"
13 #include "net/cert/signed_certificate_timestamp.h" 13 #include "net/cert/signed_certificate_timestamp.h"
14 14
15 namespace net { 15 namespace net {
16 16
17 class X509Certificate; 17 class X509Certificate;
18 18
19 namespace ct { 19 namespace ct {
20 20
21 // Represents a MerkleTreeLeaf as defined in RFC6962, section 3.4. 21 // Represents a MerkleTreeLeaf as defined in RFC6962, section 3.4.
22 // Has all the data as the MerkleTreeLeaf defined in the RFC, arranged 22 // Has all the data as the MerkleTreeLeaf defined in the RFC, arranged
23 // slightly differently. 23 // slightly differently.
24 struct NET_EXPORT MerkleTreeLeaf { 24 struct NET_EXPORT MerkleTreeLeaf {
25 // Version enum in RFC 6962, Section 3.2.
Eran Messeri 2016/05/04 10:29:23 Nit: I'd inline those in ct_serialization.cc and a
Rob Percival 2016/05/05 15:45:31 Done.
26 enum Version { VERSION_1 = 0, };
27 // MerkleLeafType enum in RFC 6962, Section 3.4.
28 enum Type { TYPE_TIMESTAMPED_ENTRY = 0, };
29
25 MerkleTreeLeaf(); 30 MerkleTreeLeaf();
26 ~MerkleTreeLeaf(); 31 ~MerkleTreeLeaf();
27 32
33 // Version and Merkle leaf type fields are omitted, as there is only one
34 // possible value for each of them in CTv1.
35
28 // The log id this leaf belongs to. 36 // The log id this leaf belongs to.
29 std::string log_id; 37 std::string log_id;
30 38
31 // Certificate / Precertificate and indication of entry type. 39 // Certificate / Precertificate and indication of entry type.
32 LogEntry log_entry; 40 LogEntry log_entry;
33 41
34 // Timestamp from the SCT. 42 // Timestamp from the SCT.
35 base::Time timestamp; 43 base::Time timestamp;
36 44
37 // Extensions from the SCT. 45 // Extensions from the SCT.
38 std::string extensions; 46 std::string extensions;
39 }; 47 };
40 48
41 NET_EXPORT bool GetMerkleTreeLeaf(const X509Certificate* cert, 49 NET_EXPORT bool GetMerkleTreeLeaf(const X509Certificate* cert,
42 const SignedCertificateTimestamp* sct, 50 const SignedCertificateTimestamp* sct,
43 MerkleTreeLeaf* merkle_tree_leaf); 51 MerkleTreeLeaf* merkle_tree_leaf);
44 52
45 } // namespace ct 53 } // namespace ct
46 54
47 } // namespace net 55 } // namespace net
48 56
49 #endif // NET_CERT_MERKLE_TREE_LEAF_H_ 57 #endif // NET_CERT_MERKLE_TREE_LEAF_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698