ct_test_util.h revision f2477e01787aa58f445919b809d89e252beef54f
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;
180f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
19f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Note: unless specified otherwise, all test data is taken from Certificate
20f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Transparency test data repository.
21f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
220f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)// Fills |entry| with test data for an X.509 entry.
230f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)void GetX509CertLogEntry(LogEntry* entry);
240f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
25f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Returns a DER-encoded X509 cert. The SCT provided by
26f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// GetX509CertSCT is signed over this certificate.
27f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)std::string GetDerEncodedX509Cert();
28f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
290f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)// Fills |entry| with test data for a Precertificate entry.
300f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)void GetPrecertLogEntry(LogEntry* entry);
310f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
320f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)// Returns the binary representation of a test DigitallySigned
330f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)std::string GetTestDigitallySigned();
340f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
350f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)// Returns the binary representation of a test serialized SCT.
360f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)std::string GetTestSignedCertificateTimestamp();
370f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
38f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Test log key
39f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)std::string GetTestPublicKey();
40f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
41f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// ID of test log key
42f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)std::string GetTestPublicKeyId();
43f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
44f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// SCT for the X509Certificate provided above.
45f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)void GetX509CertSCT(scoped_refptr<SignedCertificateTimestamp>* sct);
46f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
47f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// SCT for the Precertificate log entry provided above.
48f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)void GetPrecertSCT(scoped_refptr<SignedCertificateTimestamp>* sct);
49f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
50f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Issuer key hash
51f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)std::string GetDefaultIssuerKeyHash();
52f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
530f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)}  // namespace ct
540f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
550f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)}  // namespace net
560f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
570f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)#endif  // NET_CERT_CT_TEST_UTIL_H_
58