blob: 74e8768af33707b891a06e1da68e34244f764527 (
plain)
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
|
// Copyright (c) 2010 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_SOCKET_DNS_CERT_PROVENANCE_CHECKER_H
#define NET_SOCKET_DNS_CERT_PROVENANCE_CHECKER_H
#include <string>
#include <vector>
#include "base/string_piece.h"
namespace net {
class DnsRRResolver;
// DnsCertProvenanceChecker is an interface for asynchronously checking HTTPS
// certificates via a DNS side-channel.
class DnsCertProvenanceChecker {
public:
class Delegate {
public:
virtual ~Delegate();
virtual void OnDnsCertLookupFailed(
const std::string& hostname,
const std::vector<std::string>& der_certs) = 0;
};
virtual ~DnsCertProvenanceChecker();
virtual void Shutdown() = 0;
// DoAsyncVerification starts an asynchronous check for the given certificate
// chain. It must be run on the network thread.
virtual void DoAsyncVerification(
const std::string& hostname,
const std::vector<base::StringPiece>& der_certs) = 0;
protected:
// DoAsyncLookup performs a DNS lookup for the given name and certificate
// chain. In the event that the lookup reports a failure, the Delegate is
// called back.
static void DoAsyncLookup(
const std::string& hostname,
const std::vector<base::StringPiece>& der_certs,
DnsRRResolver* dnsrr_resolver,
Delegate* delegate);
// BuildEncryptedRecord encrypts the certificate chain to a fixed public key
// and returns the encrypted blob. Since this code is reporting a possible
// HTTPS failure, it would seem silly to use HTTPS to protect the uploaded
// report.
static std::string BuildEncryptedReport(
const std::string& hostname,
const std::vector<std::string>& der_certs);
};
} // namespace net
#endif // NET_SOCKET_DNS_CERT_PROVENANCE_CHECK_H
|