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

Unified Diff: net/cert/signed_tree_head.h

Issue 1576513002: Serialisation code for Certificate Transparency data (Closed) Base URL: ssh://caladan.lon.corp.google.com/usr/local/google/eranm/opensource_clients/chrome/src@sth_consistency_validation_2
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: net/cert/signed_tree_head.h
diff --git a/net/cert/signed_tree_head.h b/net/cert/signed_tree_head.h
index fdbcdc48499c4f439cac0471ffe32be81fe41295..8eae3a21aa0c74cc33a0c59b8354682f5e25b979 100644
--- a/net/cert/signed_tree_head.h
+++ b/net/cert/signed_tree_head.h
@@ -5,6 +5,7 @@
#ifndef NET_CERT_SIGNED_TREE_HEAD_H_
#define NET_CERT_SIGNED_TREE_HEAD_H_
+#include <ostream>
#include <string>
#include <vector>
@@ -26,15 +27,39 @@ struct NET_EXPORT SignedTreeHead {
// RFC6962-bis to use separate versions, so using a separate scheme here.
enum Version { V1 = 0, };
+ SignedTreeHead();
+ SignedTreeHead(Version version,
+ const base::Time& timestamp,
+ uint64_t tree_size,
+ const char sha256_root_hash[kSthRootHashLength],
+ const DigitallySigned& signature,
+ const std::string& log_id);
+ ~SignedTreeHead();
+
Version version;
base::Time timestamp;
uint64_t tree_size;
char sha256_root_hash[kSthRootHashLength];
DigitallySigned signature;
+
+ // Added in RFC6962-bis, Appendix A
+ std::string log_id;
};
+// Two STHs are considered equal if they are from the same log and have matching
+// timestamps, since RFC6962 forbids a log from issuing two different STHs with
+// the same timestamp.
+NET_EXPORT bool operator==(const SignedTreeHead& sth1,
+ const SignedTreeHead& sth2);
+NET_EXPORT bool operator!=(const SignedTreeHead& sth1,
+ const SignedTreeHead& sth2);
+
+NET_EXPORT std::ostream& operator<<(std::ostream& stream,
+ const SignedTreeHead& sth);
+
} // namespace ct
} // namespace net
-#endif
+#endif // NET_CERT_SIGNED_TREE_HEAD_H_
+

Powered by Google App Engine
This is Rietveld 408576698