proxygen
DefaultCertificateVerifier.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 #pragma once
10 
12 
13 namespace fizz {
14 
20 
28  public:
29  using X509VerifyCallback = int (*)(int, X509_STORE_CTX*);
30 
32  : context_(context), x509Store_(nullptr) {
33  createAuthorities();
34  }
35 
39  : context_(context), x509Store_(std::move(store)) {
40  createAuthorities();
41  }
42 
43  void verify(const std::vector<std::shared_ptr<const fizz::PeerCert>>& certs)
44  const override;
45 
47  customVerifyCallback_ = cb;
48  }
49 
51  x509Store_ = std::move(store);
52  createAuthorities();
53  }
54 
55  std::vector<Extension> getCertificateRequestExtensions() const override;
56 
57  static X509_STORE* getDefaultX509Store();
58 
59  static std::unique_ptr<DefaultCertificateVerifier> createFromCAFile(
61  const std::string& caFile);
62 
63  private:
64  void createAuthorities();
65 
69  X509VerifyCallback customVerifyCallback_{nullptr};
70 };
71 } // namespace fizz
void setX509Store(folly::ssl::X509StoreUniquePtr &&store)
void verify(int extras)
DefaultCertificateVerifier(VerificationContext context)
context
Definition: CMakeCache.txt:563
folly::ssl::X509StoreUniquePtr x509Store_
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
DefaultCertificateVerifier(VerificationContext context, folly::ssl::X509StoreUniquePtr &&store)
STL namespace.
#define nullptr
Definition: http_parser.c:41
std::unique_ptr< X509_STORE, X509StoreDeleter > X509StoreUniquePtr
Definition: Actions.h:16
const char * string
Definition: Conv.cpp:212
int(*)(int, X509_STORE_CTX *) X509VerifyCallback
void setCustomVerifyCallback(X509VerifyCallback cb)