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 9bc6f958da7575a5d8f85d0ec33e09c8e99a63b3..f151ed6e766ffb48d1dbf1e4205264a7d84f9d98 100644 |
| --- a/net/test/ct_test_util.cc |
| +++ b/net/test/ct_test_util.cc |
| @@ -15,6 +15,7 @@ |
| #include "base/strings/stringprintf.h" |
| #include "net/cert/ct_serialization.h" |
| #include "net/cert/ct_verify_result.h" |
| +#include "net/cert/merkle_tree_leaf.h" |
| #include "net/cert/signed_tree_head.h" |
| #include "net/cert/x509_certificate.h" |
| @@ -78,6 +79,8 @@ const char kDefaultDerTbsCert[] = |
| "41310e300c0603550408130557616c65733110300e060355040713074572772057656e8201" |
| "0030090603551d1304023000"; |
| +const char kDefaultExtensions[] = "666f6f626172"; // "foobar" |
| + |
| const char kTestDigitallySigned[] = |
| "0403004730450220606e10ae5c2d5a1b0aed49dc4937f48de71a4e9784e9c208dfbfe9ef53" |
| "6cf7f2022100beb29c72d7d06d61d06bdb38a069469aa86fe12e18bb7cc45689a2c0187ef5" |
| @@ -97,6 +100,8 @@ const char kEcP256PublicKey[] = |
| const char kTestKeyId[] = |
| "df1c2ec11500945247a96168325ddc5c7959e8f7c6d388fc002e0bbd3f74d764"; |
| +const int64_t kTestTimestamp = INT64_C(1396877277237); |
|
Eran Messeri
2016/05/05 15:59:33
Given the value here is exactly the same as of kSa
Rob Percival
2016/05/05 17:31:43
Done.
|
| + |
| const char kTestSCTSignatureData[] = |
| "30450220606e10ae5c2d5a1b0aed49dc4937f48de71a4e9784e9c208dfbfe9ef536cf7f202" |
| "2100beb29c72d7d06d61d06bdb38a069469aa86fe12e18bb7cc45689a2c0187ef5a5"; |
| @@ -155,7 +160,6 @@ const char kFakeOCSPResponseIssuerCert[] = |
| "3ea1e11df2ccb357a5fed5220f9c6239e8946b9b7517707631d51ab996833d58a022cff5a6" |
| "2169ac9258ec110efee78da9ab4a641e3b3c9ee5e8bd291460"; |
| - |
| const char kFakeOCSPExtensionValue[] = "74657374"; // "test" |
| // For the sample STH |
| @@ -175,6 +179,13 @@ void GetX509CertLogEntry(LogEntry* entry) { |
| entry->leaf_certificate = HexToBytes(kDefaultDerCert); |
| } |
| +void GetX509CertTreeLeaf(MerkleTreeLeaf* tree_leaf) { |
| + tree_leaf->log_id = HexToBytes(kTestKeyId); |
| + tree_leaf->timestamp = base::Time::FromJsTime(kTestTimestamp); |
| + GetX509CertLogEntry(&tree_leaf->log_entry); |
| + tree_leaf->extensions = HexToBytes(kDefaultExtensions); |
| +} |
| + |
| std::string GetDerEncodedX509Cert() { return HexToBytes(kDefaultDerCert); } |
| void GetPrecertLogEntry(LogEntry* entry) { |
| @@ -184,6 +195,13 @@ void GetPrecertLogEntry(LogEntry* entry) { |
| entry->tbs_certificate = HexToBytes(kDefaultDerTbsCert); |
| } |
| +void GetPrecertTreeLeaf(MerkleTreeLeaf* tree_leaf) { |
| + tree_leaf->log_id = HexToBytes(kTestKeyId); |
| + tree_leaf->timestamp = base::Time::FromJsTime(kTestTimestamp); |
| + GetPrecertLogEntry(&tree_leaf->log_entry); |
| + tree_leaf->extensions = HexToBytes(kDefaultExtensions); |
| +} |
| + |
| std::string GetTestDigitallySigned() { |
| return HexToBytes(kTestDigitallySigned); |
| } |