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

Unified Diff: net/test/ct_test_util.cc

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
« net/test/ct_test_util.h ('K') | « net/test/ct_test_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/test/ct_test_util.cc
diff --git a/net/test/ct_test_util.cc b/net/test/ct_test_util.cc
index 3bd30ff41351b51b49f2a8cf614a85b1efb9a2a7..302985b97cdd01d651f3946b1a9df6a766033591 100644
--- a/net/test/ct_test_util.cc
+++ b/net/test/ct_test_util.cc
@@ -205,7 +205,7 @@ void GetX509CertSCT(scoped_refptr<SignedCertificateTimestamp>* sct_ref) {
*sct_ref = new SignedCertificateTimestamp();
SignedCertificateTimestamp *const sct(sct_ref->get());
sct->version = ct::SignedCertificateTimestamp::SCT_VERSION_1;
- sct->log_id = HexToBytes(kTestKeyId);
+ sct->log_id = GetTestPublicKeyId();
// Time the log issued a SCT for this certificate, which is
// Fri Apr 5 10:04:16.089 2013
sct->timestamp = base::Time::UnixEpoch() +
@@ -222,7 +222,7 @@ void GetPrecertSCT(scoped_refptr<SignedCertificateTimestamp>* sct_ref) {
*sct_ref = new SignedCertificateTimestamp();
SignedCertificateTimestamp *const sct(sct_ref->get());
sct->version = ct::SignedCertificateTimestamp::SCT_VERSION_1;
- sct->log_id = HexToBytes(kTestKeyId);
+ sct->log_id = GetTestPublicKeyId();
// Time the log issued a SCT for this Precertificate, which is
// Fri Apr 5 10:04:16.275 2013
sct->timestamp = base::Time::UnixEpoch() +
@@ -257,6 +257,7 @@ std::string GetDerEncodedFakeOCSPResponseIssuerCert() {
// A sample, valid STH
void GetSampleSignedTreeHead(SignedTreeHead* sth) {
sth->version = SignedTreeHead::V1;
+ sth->log_id = GetTestPublicKeyId();
sth->timestamp = base::Time::UnixEpoch() +
base::TimeDelta::FromMilliseconds(kSampleSTHTimestamp);
sth->tree_size = kSampleSTHTreeSize;
@@ -281,6 +282,21 @@ void GetSampleSTHTreeHeadDecodedSignature(DigitallySigned* signature) {
CHECK(sp.empty());
}
+std::string GetSampleSTH() {
+ const std::string log_id = ct::GetTestPublicKeyId();
+ const std::string timestamp("\x0\x0\x1\x45\x3c\x5f\xb8\x35", 8);
Eran Messeri 2016/01/14 12:46:45 Why not use the encoding functions you've added to
+ const std::string tree_size("\x0\x0\x0\x0\x0\x0\x0\x15", 8);
+
+ std::string expected_output;
+ expected_output += log_id;
+ expected_output += timestamp;
+ expected_output += tree_size;
+ expected_output += ct::GetSampleSTHSHA256RootHash();
+ expected_output += ct::GetSampleSTHTreeHeadSignature();
+
+ return expected_output;
+}
+
std::string GetSampleSTHAsJson() {
return CreateSignedTreeHeadJsonString(kSampleSTHTreeSize, kSampleSTHTimestamp,
GetSampleSTHSHA256RootHash(),
« net/test/ct_test_util.h ('K') | « net/test/ct_test_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698