proxygen
CertManager.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 
11 #include <map>
12 #include <unordered_map>
13 
15 
16 namespace fizz {
17 namespace server {
18 
19 class CertManager {
20  public:
21  using CertMatch =
23 
24  virtual ~CertManager() = default;
25 
32  virtual CertMatch getCert(
34  const std::vector<SignatureScheme>& supportedSigSchemes,
35  const std::vector<SignatureScheme>& peerSigSchemes) const;
36 
41  virtual std::shared_ptr<SelfCert> getCert(const std::string& identity) const;
42 
43  void addCert(std::shared_ptr<SelfCert> cert, bool defaultCert = false);
44 
45  private:
47  const std::string& key,
48  const std::vector<SignatureScheme>& supportedSigSchemes,
49  const std::vector<SignatureScheme>& peerSigSchemes,
50  CertMatch& lastResort) const;
51 
52  void addCertIdentity(
53  std::shared_ptr<SelfCert> cert,
54  const std::string& ident);
55 
56  using SigSchemeMap = std::map<SignatureScheme, std::shared_ptr<SelfCert>>;
57  std::unordered_map<std::string, SigSchemeMap> certs_;
58  std::unordered_map<std::string, std::shared_ptr<SelfCert>> identMap_;
60 };
61 } // namespace server
62 } // namespace fizz
virtual CertMatch getCert(const folly::Optional< std::string > &sni, const std::vector< SignatureScheme > &supportedSigSchemes, const std::vector< SignatureScheme > &peerSigSchemes) const
Definition: CertManager.cpp:45
virtual ~CertManager()=default
std::map< SignatureScheme, std::shared_ptr< SelfCert >> SigSchemeMap
Definition: CertManager.h:56
SignatureScheme
Definition: Types.h:257
Definition: Actions.h:16
StringPiece sni
const char * string
Definition: Conv.cpp:212
void addCertIdentity(std::shared_ptr< SelfCert > cert, const std::string &ident)
void addCert(std::shared_ptr< SelfCert > cert, bool defaultCert=false)
std::unordered_map< std::string, SigSchemeMap > certs_
Definition: CertManager.h:57
CertMatch findCert(const std::string &key, const std::vector< SignatureScheme > &supportedSigSchemes, const std::vector< SignatureScheme > &peerSigSchemes, CertMatch &lastResort) const
Definition: CertManager.cpp:21
std::unordered_map< std::string, std::shared_ptr< SelfCert > > identMap_
Definition: CertManager.h:58