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

Unified Diff: net/test/ct_test_util.cc

Issue 1845113003: Certificate Transparency: Start tracking logs' state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « 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 9bc6f958da7575a5d8f85d0ec33e09c8e99a63b3..aba7b9a50e4d7bfc62091616c48099f8e213bf79 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
bool GetSampleSignedTreeHead(SignedTreeHead* sth) {
sth->version = SignedTreeHead::V1;
+ sth->log_id = GetTestPublicKeyId();
sth->timestamp = base::Time::UnixEpoch() +
base::TimeDelta::FromMilliseconds(kSampleSTHTimestamp);
sth->tree_size = kSampleSTHTreeSize;
@@ -312,6 +313,21 @@ bool GetSampleSTHTreeHeadDecodedSignature(DigitallySigned* signature) {
return DecodeDigitallySigned(&sp, signature) && 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);
+ 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(),
« no previous file with comments | « net/test/ct_test_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698