Chromium Code Reviews| 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(), |