10f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
20f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
30f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)// found in the LICENSE file.
40f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
50f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)#ifndef NET_CERT_CT_TEST_UTIL_H_
60f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)#define NET_CERT_CT_TEST_UTIL_H_
70f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
80f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)#include <string>
90f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
10f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "base/memory/ref_counted.h"
110f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
12f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)namespace net {
130f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
140f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)namespace ct {
150f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
160f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)struct LogEntry;
170f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)struct SignedCertificateTimestamp;
18cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)struct SignedTreeHead;
190f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
20f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Note: unless specified otherwise, all test data is taken from Certificate
21f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Transparency test data repository.
22f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
230f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)// Fills |entry| with test data for an X.509 entry.
240f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)void GetX509CertLogEntry(LogEntry* entry);
250f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
26f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Returns a DER-encoded X509 cert. The SCT provided by
27f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// GetX509CertSCT is signed over this certificate.
28f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)std::string GetDerEncodedX509Cert();
29f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
300f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)// Fills |entry| with test data for a Precertificate entry.
310f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)void GetPrecertLogEntry(LogEntry* entry);
320f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
330f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)// Returns the binary representation of a test DigitallySigned
340f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)std::string GetTestDigitallySigned();
350f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
360f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)// Returns the binary representation of a test serialized SCT.
370f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)std::string GetTestSignedCertificateTimestamp();
380f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
39f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Test log key
40f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)std::string GetTestPublicKey();
41f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
42f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// ID of test log key
43f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)std::string GetTestPublicKeyId();
44f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
45f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// SCT for the X509Certificate provided above.
46f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)void GetX509CertSCT(scoped_refptr<SignedCertificateTimestamp>* sct);
47f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
48f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// SCT for the Precertificate log entry provided above.
49f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)void GetPrecertSCT(scoped_refptr<SignedCertificateTimestamp>* sct);
50f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
51f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Issuer key hash
52f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)std::string GetDefaultIssuerKeyHash();
53f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Fake OCSP response with an embedded SCT list.
555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)std::string GetDerEncodedFakeOCSPResponse();
565d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
575d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// The SCT list embedded in the response above.
585d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)std::string GetFakeOCSPExtensionValue();
595d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
605d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// The cert the OCSP response is for.
615d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)std::string GetDerEncodedFakeOCSPResponseCert();
625d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// The issuer of the previous cert.
645d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)std::string GetDerEncodedFakeOCSPResponseIssuerCert();
655d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
66cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// A sample, valid STH
67cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)void GetSignedTreeHead(SignedTreeHead* sth);
68cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
69cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// The SHA256 root hash for the sample STH
70cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)std::string GetSampleSTHSHA256RootHash();
71cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
720f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)}  // namespace ct
730f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
740f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)}  // namespace net
750f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
760f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)#endif  // NET_CERT_CT_TEST_UTIL_H_
77