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

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

Issue 71633002: Convert SignedCertificateClass to be ref_counted, and add an SCTStore in which to store them. Add S… Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: few lint fixes 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/sct_status_flags.h ('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
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/memory/ref_counted.h"
11 #include "base/time/time.h" 12 #include "base/time/time.h"
12 #include "net/base/hash_value.h" 13 #include "net/base/hash_value.h"
13 #include "net/base/net_export.h" 14 #include "net/base/net_export.h"
14 15
15 namespace net { 16 namespace net {
16 17
17 // Structures related to Certificate Transparency (RFC6962). 18 // Structures related to Certificate Transparency (RFC6962).
18 namespace ct { 19 namespace ct {
19 20
20 // LogEntry struct in RFC 6962, Section 3.1 21 // LogEntry struct in RFC 6962, Section 3.1
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 DigitallySigned(); 63 DigitallySigned();
63 ~DigitallySigned(); 64 ~DigitallySigned();
64 65
65 HashAlgorithm hash_algorithm; 66 HashAlgorithm hash_algorithm;
66 SignatureAlgorithm signature_algorithm; 67 SignatureAlgorithm signature_algorithm;
67 // 'signature' field. 68 // 'signature' field.
68 std::string signature_data; 69 std::string signature_data;
69 }; 70 };
70 71
71 // SignedCertificateTimestamp struct in RFC 6962, Section 3.2. 72 // SignedCertificateTimestamp struct in RFC 6962, Section 3.2.
72 struct NET_EXPORT SignedCertificateTimestamp { 73 struct NET_EXPORT SignedCertificateTimestamp
74 : public base::RefCountedThreadSafe<SignedCertificateTimestamp> {
75 // Predicate functor used in maps when SignedCertificateTimestamp is used as
76 // the key.
77 struct NET_EXPORT LessThan {
78 bool operator()(const scoped_refptr<SignedCertificateTimestamp>& lhs,
79 const scoped_refptr<SignedCertificateTimestamp>& rhs) const;
80
81 };
82
73 // Version enum in RFC 6962, Section 3.2. 83 // Version enum in RFC 6962, Section 3.2.
74 enum Version { 84 enum Version {
75 SCT_VERSION_1 = 0, 85 SCT_VERSION_1 = 0,
76 }; 86 };
77 87
78 // Source of the SCT - supplementary, not defined in CT RFC. 88 // Source of the SCT - supplementary, not defined in CT RFC.
79 enum Origin { 89 enum Origin {
80 SCT_EMBEDDED = 0, 90 SCT_EMBEDDED = 0,
81 SCT_FROM_TLS_HANDSHAKE = 1, 91 SCT_FROM_TLS_HANDSHAKE = 1,
82 SCT_FROM_OCSP_RESPONSE = 2, 92 SCT_FROM_OCSP_RESPONSE = 2,
83 }; 93 };
84 94
85 SignedCertificateTimestamp(); 95 SignedCertificateTimestamp();
86 ~SignedCertificateTimestamp();
87 96
88 Version version; 97 Version version;
89 std::string log_id; 98 std::string log_id;
90 base::Time timestamp; 99 base::Time timestamp;
91 std::string extensions; 100 std::string extensions;
92 DigitallySigned signature; 101 DigitallySigned signature;
93 // The origin should not participate in equality checks 102 // The origin should not participate in equality checks
94 // as the same SCT can be provided from multiple sources. 103 // as the same SCT can be provided from multiple sources.
95 Origin origin; 104 Origin origin;
105
106 private:
107 ~SignedCertificateTimestamp();
108 friend class base::RefCountedThreadSafe<SignedCertificateTimestamp>;
109 DISALLOW_COPY_AND_ASSIGN(SignedCertificateTimestamp);
96 }; 110 };
97 111
98 } // namespace ct 112 } // namespace ct
99 113
100 } // namespace net 114 } // namespace net
101 115
102 #endif // NET_CERT_SIGNED_CERTIFICATE_TIMESTAMP_H_ 116 #endif // NET_CERT_SIGNED_CERTIFICATE_TIMESTAMP_H_
OLDNEW
« no previous file with comments | « net/cert/sct_status_flags.h ('k') | net/cert/signed_certificate_timestamp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698