Revert "Fix broken channel icon in chrome://help on CrOS" and try again
[chromium-blink-merge.git] / net / test / ct_test_util.h
blob5701a288272df17da9ab6229d2239396a99fb691
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 DigitallySigned;
17 struct LogEntry;
18 struct SignedCertificateTimestamp;
19 struct SignedTreeHead;
21 // Note: unless specified otherwise, all test data is taken from Certificate
22 // Transparency test data repository.
24 // Fills |entry| with test data for an X.509 entry.
25 void GetX509CertLogEntry(LogEntry* entry);
27 // Returns a DER-encoded X509 cert. The SCT provided by
28 // GetX509CertSCT is signed over this certificate.
29 std::string GetDerEncodedX509Cert();
31 // Fills |entry| with test data for a Precertificate entry.
32 void GetPrecertLogEntry(LogEntry* entry);
34 // Returns the binary representation of a test DigitallySigned
35 std::string GetTestDigitallySigned();
37 // Returns the binary representation of a test serialized SCT.
38 std::string GetTestSignedCertificateTimestamp();
40 // Test log key
41 std::string GetTestPublicKey();
43 // ID of test log key
44 std::string GetTestPublicKeyId();
46 // SCT for the X509Certificate provided above.
47 void GetX509CertSCT(scoped_refptr<SignedCertificateTimestamp>* sct);
49 // SCT for the Precertificate log entry provided above.
50 void GetPrecertSCT(scoped_refptr<SignedCertificateTimestamp>* sct);
52 // Issuer key hash
53 std::string GetDefaultIssuerKeyHash();
55 // Fake OCSP response with an embedded SCT list.
56 std::string GetDerEncodedFakeOCSPResponse();
58 // The SCT list embedded in the response above.
59 std::string GetFakeOCSPExtensionValue();
61 // The cert the OCSP response is for.
62 std::string GetDerEncodedFakeOCSPResponseCert();
64 // The issuer of the previous cert.
65 std::string GetDerEncodedFakeOCSPResponseIssuerCert();
67 // A sample, valid STH.
68 void GetSampleSignedTreeHead(SignedTreeHead* sth);
70 // The SHA256 root hash for the sample STH.
71 std::string GetSampleSTHSHA256RootHash();
73 // The tree head signature for the sample STH.
74 std::string GetSampleSTHTreeHeadSignature();
76 // The same signature as GetSampleSTHTreeHeadSignature, decoded.
77 void GetSampleSTHTreeHeadDecodedSignature(DigitallySigned* signature);
79 // The sample STH in JSON form.
80 std::string GetSampleSTHAsJson();
82 // Assembles, and returns, a sample STH in JSON format using
83 // the provided parameters.
84 std::string CreateSignedTreeHeadJsonString(size_t tree_size,
85 int64_t timestamp,
86 std::string sha256_root_hash,
87 std::string tree_head_signature);
89 } // namespace ct
91 } // namespace net
93 #endif // NET_CERT_CT_TEST_UTIL_H_