blob: 94fe131bd07dbbdee7f96ced106d7c7515d32ba6 [file] [log] [blame]
QUICHE team83760d32020-01-24 13:18:40 -08001// Copyright (c) 2020 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 QUICHE_QUIC_CORE_CRYPTO_SERVER_PROOF_VERIFIER_H_
6#define QUICHE_QUIC_CORE_CRYPTO_SERVER_PROOF_VERIFIER_H_
7
8#include <memory>
9#include <string>
10#include <vector>
11
12#include "net/third_party/quiche/src/quic/core/crypto/proof_verifier.h"
13#include "net/third_party/quiche/src/quic/core/quic_types.h"
14
15namespace quic {
16
17// A ServerProofVerifier checks the certificate chain presented by a client.
18class QUIC_EXPORT_PRIVATE ServerProofVerifier {
19 public:
20 virtual ~ServerProofVerifier() {}
21
22 // VerifyCertChain checks that |certs| is a valid chain. On success, it
23 // returns QUIC_SUCCESS. On failure, it returns QUIC_FAILURE and sets
24 // |*error_details| to a description of the problem. In either case it may set
25 // |*details|, which the caller takes ownership of.
26 //
27 // |context| specifies an implementation specific struct (which may be nullptr
28 // for some implementations) that provides useful information for the
29 // verifier, e.g. logging handles.
30 //
31 // This function may also return QUIC_PENDING, in which case the
32 // ServerProofVerifier will call back, on the original thread, via |callback|
33 // when complete. In this case, the ServerProofVerifier will take ownership of
34 // |callback|.
35 virtual QuicAsyncStatus VerifyCertChain(
36 const std::vector<std::string>& certs,
37 std::string* error_details,
38 std::unique_ptr<ProofVerifierCallback> callback) = 0;
39};
40
41} // namespace quic
42#endif // QUICHE_QUIC_CORE_CRYPTO_SERVER_PROOF_VERIFIER_H_