PlzNavigate: Improvements to RFHM commit logic.
[chromium-blink-merge.git] / net / test / ct_test_util.h
blobf3b8c6b3f691e7ddf62dce341aca4ad85f8d7288
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef NET_CERT_CT_TEST_UTIL_H_
6 #define NET_CERT_CT_TEST_UTIL_H_
8 #include <string>
10 #include "base/memory/ref_counted.h"
12 namespace net {
14 namespace ct {
16 struct LogEntry;
17 struct SignedCertificateTimestamp;
18 struct SignedTreeHead;
20 // Note: unless specified otherwise, all test data is taken from Certificate
21 // Transparency test data repository.
23 // Fills |entry| with test data for an X.509 entry.
24 void GetX509CertLogEntry(LogEntry* entry);
26 // Returns a DER-encoded X509 cert. The SCT provided by
27 // GetX509CertSCT is signed over this certificate.
28 std::string GetDerEncodedX509Cert();
30 // Fills |entry| with test data for a Precertificate entry.
31 void GetPrecertLogEntry(LogEntry* entry);
33 // Returns the binary representation of a test DigitallySigned
34 std::string GetTestDigitallySigned();
36 // Returns the binary representation of a test serialized SCT.
37 std::string GetTestSignedCertificateTimestamp();
39 // Test log key
40 std::string GetTestPublicKey();
42 // ID of test log key
43 std::string GetTestPublicKeyId();
45 // SCT for the X509Certificate provided above.
46 void GetX509CertSCT(scoped_refptr<SignedCertificateTimestamp>* sct);
48 // SCT for the Precertificate log entry provided above.
49 void GetPrecertSCT(scoped_refptr<SignedCertificateTimestamp>* sct);
51 // Issuer key hash
52 std::string GetDefaultIssuerKeyHash();
54 // Fake OCSP response with an embedded SCT list.
55 std::string GetDerEncodedFakeOCSPResponse();
57 // The SCT list embedded in the response above.
58 std::string GetFakeOCSPExtensionValue();
60 // The cert the OCSP response is for.
61 std::string GetDerEncodedFakeOCSPResponseCert();
63 // The issuer of the previous cert.
64 std::string GetDerEncodedFakeOCSPResponseIssuerCert();
66 // A sample, valid STH
67 void GetSignedTreeHead(SignedTreeHead* sth);
69 // The SHA256 root hash for the sample STH
70 std::string GetSampleSTHSHA256RootHash();
72 } // namespace ct
74 } // namespace net
76 #endif // NET_CERT_CT_TEST_UTIL_H_