ct_test_util.h revision 5d1f7b1de12d16ceb2c938c56701a3e8bfa558f7
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.
4
5#ifndef NET_CERT_CT_TEST_UTIL_H_
6#define NET_CERT_CT_TEST_UTIL_H_
7
8#include <string>
9
10#include "base/memory/ref_counted.h"
11
12namespace net {
13
14namespace ct {
15
16struct LogEntry;
17struct SignedCertificateTimestamp;
18
19// Note: unless specified otherwise, all test data is taken from Certificate
20// Transparency test data repository.
21
22// Fills |entry| with test data for an X.509 entry.
23void GetX509CertLogEntry(LogEntry* entry);
24
25// Returns a DER-encoded X509 cert. The SCT provided by
26// GetX509CertSCT is signed over this certificate.
27std::string GetDerEncodedX509Cert();
28
29// Fills |entry| with test data for a Precertificate entry.
30void GetPrecertLogEntry(LogEntry* entry);
31
32// Returns the binary representation of a test DigitallySigned
33std::string GetTestDigitallySigned();
34
35// Returns the binary representation of a test serialized SCT.
36std::string GetTestSignedCertificateTimestamp();
37
38// Test log key
39std::string GetTestPublicKey();
40
41// ID of test log key
42std::string GetTestPublicKeyId();
43
44// SCT for the X509Certificate provided above.
45void GetX509CertSCT(scoped_refptr<SignedCertificateTimestamp>* sct);
46
47// SCT for the Precertificate log entry provided above.
48void GetPrecertSCT(scoped_refptr<SignedCertificateTimestamp>* sct);
49
50// Issuer key hash
51std::string GetDefaultIssuerKeyHash();
52
53// Fake OCSP response with an embedded SCT list.
54std::string GetDerEncodedFakeOCSPResponse();
55
56// The SCT list embedded in the response above.
57std::string GetFakeOCSPExtensionValue();
58
59// The cert the OCSP response is for.
60std::string GetDerEncodedFakeOCSPResponseCert();
61
62// The issuer of the previous cert.
63std::string GetDerEncodedFakeOCSPResponseIssuerCert();
64
65}  // namespace ct
66
67}  // namespace net
68
69#endif  // NET_CERT_CT_TEST_UTIL_H_
70