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