OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SIGNED_CERTIFICATE_TIMESTAMP_H_ | 5 #ifndef NET_CERT_SIGNED_CERTIFICATE_TIMESTAMP_H_ |
6 #define NET_CERT_SIGNED_CERTIFICATE_TIMESTAMP_H_ | 6 #define NET_CERT_SIGNED_CERTIFICATE_TIMESTAMP_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "net/base/hash_value.h" | 14 #include "net/base/hash_value.h" |
15 #include "net/base/net_export.h" | 15 #include "net/base/net_export.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class Pickle; | 18 class Pickle; |
19 class PickleIterator; | 19 class PickleIterator; |
20 } | 20 } |
21 | 21 |
22 namespace net { | 22 namespace net { |
23 | 23 |
24 // Structures related to Certificate Transparency (RFC6962). | 24 // Structures related to Certificate Transparency (RFC6962). |
25 namespace ct { | 25 namespace ct { |
26 | 26 |
27 // LogEntry struct in RFC 6962, Section 3.1 | 27 // Contains the data necessary to reconstruct the signed_entry of a |
28 struct NET_EXPORT LogEntry { | 28 // SignedCertificateTimestamp, from RFC 6962, Section 3.2. |
| 29 // |
| 30 // All the data necessary to validate a SignedCertificateTimestamp is present |
| 31 // within the SignedCertificateTimestamp, except for the signature_type, |
| 32 // entry_type, and the actual entry. The only supported signature_type at |
| 33 // present is certificate_timestamp. The entry_type is implicit from the |
| 34 // context in which it is received (those in the X.509 extension are |
| 35 // precert_entry, all others are x509_entry). The signed_entry itself is |
| 36 // reconstructed from the certificate being verified, or from the corresponding |
| 37 // precertificate. |
| 38 // |
| 39 // The SignedEntryData contains this reconstructed data, and can be used to |
| 40 // either generate or verify the signature in SCTs. |
| 41 struct NET_EXPORT SignedEntryData { |
29 // LogEntryType enum in RFC 6962, Section 3.1 | 42 // LogEntryType enum in RFC 6962, Section 3.1 |
30 enum Type { | 43 enum Type { |
31 LOG_ENTRY_TYPE_X509 = 0, | 44 LOG_ENTRY_TYPE_X509 = 0, |
32 LOG_ENTRY_TYPE_PRECERT = 1 | 45 LOG_ENTRY_TYPE_PRECERT = 1 |
33 }; | 46 }; |
34 | 47 |
35 LogEntry(); | 48 SignedEntryData(); |
36 ~LogEntry(); | 49 ~SignedEntryData(); |
37 void Reset(); | 50 void Reset(); |
38 | 51 |
39 Type type; | 52 Type type; |
40 | 53 |
41 // Set if type == LOG_ENTRY_TYPE_X509 | 54 // Set if type == LOG_ENTRY_TYPE_X509 |
42 std::string leaf_certificate; | 55 std::string leaf_certificate; |
43 | 56 |
44 // Set if type == LOG_ENTRY_TYPE_PRECERT | 57 // Set if type == LOG_ENTRY_TYPE_PRECERT |
45 SHA256HashValue issuer_key_hash; | 58 SHA256HashValue issuer_key_hash; |
46 std::string tbs_certificate; | 59 std::string tbs_certificate; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 ~SignedCertificateTimestamp(); | 143 ~SignedCertificateTimestamp(); |
131 | 144 |
132 DISALLOW_COPY_AND_ASSIGN(SignedCertificateTimestamp); | 145 DISALLOW_COPY_AND_ASSIGN(SignedCertificateTimestamp); |
133 }; | 146 }; |
134 | 147 |
135 } // namespace ct | 148 } // namespace ct |
136 | 149 |
137 } // namespace net | 150 } // namespace net |
138 | 151 |
139 #endif // NET_CERT_SIGNED_CERTIFICATE_TIMESTAMP_H_ | 152 #endif // NET_CERT_SIGNED_CERTIFICATE_TIMESTAMP_H_ |
OLD | NEW |