| 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 (or precertificate) being verified. |
| 37 // |
| 38 // The SignedEntryData contains this reconstructed data, and can be used to |
| 39 // either generate or verify SCTs. |
| 40 struct NET_EXPORT SignedEntryData { |
| 29 // LogEntryType enum in RFC 6962, Section 3.1 | 41 // LogEntryType enum in RFC 6962, Section 3.1 |
| 30 enum Type { | 42 enum Type { |
| 31 LOG_ENTRY_TYPE_X509 = 0, | 43 LOG_ENTRY_TYPE_X509 = 0, |
| 32 LOG_ENTRY_TYPE_PRECERT = 1 | 44 LOG_ENTRY_TYPE_PRECERT = 1 |
| 33 }; | 45 }; |
| 34 | 46 |
| 35 LogEntry(); | 47 SignedEntryData(); |
| 36 ~LogEntry(); | 48 ~SignedEntryData(); |
| 37 void Reset(); | 49 void Reset(); |
| 38 | 50 |
| 39 Type type; | 51 Type type; |
| 40 | 52 |
| 41 // Set if type == LOG_ENTRY_TYPE_X509 | 53 // Set if type == LOG_ENTRY_TYPE_X509 |
| 42 std::string leaf_certificate; | 54 std::string leaf_certificate; |
| 43 | 55 |
| 44 // Set if type == LOG_ENTRY_TYPE_PRECERT | 56 // Set if type == LOG_ENTRY_TYPE_PRECERT |
| 45 SHA256HashValue issuer_key_hash; | 57 SHA256HashValue issuer_key_hash; |
| 46 std::string tbs_certificate; | 58 std::string tbs_certificate; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 ~SignedCertificateTimestamp(); | 142 ~SignedCertificateTimestamp(); |
| 131 | 143 |
| 132 DISALLOW_COPY_AND_ASSIGN(SignedCertificateTimestamp); | 144 DISALLOW_COPY_AND_ASSIGN(SignedCertificateTimestamp); |
| 133 }; | 145 }; |
| 134 | 146 |
| 135 } // namespace ct | 147 } // namespace ct |
| 136 | 148 |
| 137 } // namespace net | 149 } // namespace net |
| 138 | 150 |
| 139 #endif // NET_CERT_SIGNED_CERTIFICATE_TIMESTAMP_H_ | 151 #endif // NET_CERT_SIGNED_CERTIFICATE_TIMESTAMP_H_ |
| OLD | NEW |