1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_CERT_CT_VERIFIER_H_
#define NET_CERT_CT_VERIFIER_H_
#include <string>
#include "net/base/net_export.h"
namespace net {
namespace ct {
struct CTVerifyResult;
struct SignedCertificateTimestamp;
} // namespace ct
class BoundNetLog;
class CTLogVerifier;
class X509Certificate;
// Interface for verifying Signed Certificate Timestamps over a certificate.
class NET_EXPORT CTVerifier {
public:
class NET_EXPORT Observer {
public:
// Called for each Signed Certificate Timestamp from a known log that vas
// verified successfully (i.e. the signature verifies). |sct| is the
// Signed Certificate Timestamp, |cert| is the certificate it applies to.
// The certificate is needed to calculate the hash of the log entry,
// necessary for checking inclusion in the log.
virtual void OnSCTVerified(X509Certificate* cert,
const ct::SignedCertificateTimestamp* sct) = 0;
};
virtual ~CTVerifier() {}
// Verifies SCTs embedded in the certificate itself, SCTs embedded in a
// stapled OCSP response, and SCTs obtained via the
// signed_certificate_timestamp TLS extension on the given |cert|.
// A certificate is permitted but not required to use multiple sources for
// SCTs. It is expected that most certificates will use only one source
// (embedding, TLS extension or OCSP stapling). If no stapled OCSP response
// is available, |stapled_ocsp_response| should be an empty string. If no SCT
// TLS extension was negotiated, |sct_list_from_tls_extension| should be an
// empty string. |result| will be filled with the SCTs present, divided into
// categories based on the verification result.
virtual int Verify(X509Certificate* cert,
const std::string& stapled_ocsp_response,
const std::string& sct_list_from_tls_extension,
ct::CTVerifyResult* result,
const BoundNetLog& net_log) = 0;
// Registers |observer| to receive notifications of validated SCTs. Does not
// take ownership of the observer as the observer may be performing
// URLRequests which have to be cancelled before this object is destroyed.
// Setting |observer| to nullptr has the effect of stopping all notifications.
virtual void SetObserver(Observer* observer) = 0;
};
} // namespace net
#endif // NET_CERT_CT_VERIFIER_H_
|