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_MULTI_LOG_CT_VERIFIER_H_
6 #define NET_CERT_MULTI_LOG_CT_VERIFIER_H_
11 #include "base/memory/ref_counted.h"
12 #include "net/base/net_export.h"
13 #include "net/cert/ct_verifier.h"
14 #include "net/cert/signed_certificate_timestamp.h"
24 // A Certificate Transparency verifier that can verify Signed Certificate
25 // Timestamps from multiple logs.
26 // There should be a global instance of this class and for all known logs,
27 // AddLog should be called with a CTLogVerifier (which is created from the
29 class NET_EXPORT MultiLogCTVerifier
: public CTVerifier
{
32 ~MultiLogCTVerifier() override
;
34 void AddLogs(const std::vector
<scoped_refptr
<CTLogVerifier
>>& log_verifiers
);
36 // CTVerifier implementation:
37 int Verify(X509Certificate
* cert
,
38 const std::string
& stapled_ocsp_response
,
39 const std::string
& sct_list_from_tls_extension
,
40 ct::CTVerifyResult
* result
,
41 const BoundNetLog
& net_log
) override
;
43 void SetObserver(Observer
* observer
) override
;
46 // Verify a list of SCTs from |encoded_sct_list| over |expected_entry|,
47 // placing the verification results in |result|. The SCTs in the list
48 // come from |origin| (as will be indicated in the origin field of each SCT).
49 bool VerifySCTs(const std::string
& encoded_sct_list
,
50 const ct::LogEntry
& expected_entry
,
51 ct::SignedCertificateTimestamp::Origin origin
,
52 X509Certificate
* cert
,
53 ct::CTVerifyResult
* result
);
55 // Verifies a single, parsed SCT against all logs.
56 bool VerifySingleSCT(scoped_refptr
<ct::SignedCertificateTimestamp
> sct
,
57 const ct::LogEntry
& expected_entry
,
58 X509Certificate
* cert
,
59 ct::CTVerifyResult
* result
);
61 // Mapping from a log's ID to the verifier for this log.
62 // A log's ID is the SHA-256 of the log's key, as defined in section 3.2.
64 std::map
<std::string
, scoped_refptr
<CTLogVerifier
>> logs_
;
68 DISALLOW_COPY_AND_ASSIGN(MultiLogCTVerifier
);
73 #endif // NET_CERT_MULTI_LOG_CT_VERIFIER_H_