#include <CertManager.h>
Definition at line 19 of file CertManager.h.
virtual fizz::server::CertManager::~CertManager |
( |
| ) |
|
|
virtualdefault |
void fizz::server::CertManager::addCert |
( |
std::shared_ptr< SelfCert > |
cert, |
|
|
bool |
defaultCert = false |
|
) |
| |
Definition at line 129 of file CertManager.cpp.
References fizz::server::getKeyFromIdent().
130 auto primaryIdent = cert->getIdentity();
133 auto altIdents = cert->getAltIdentities();
134 for (
const auto& ident : altIdents) {
135 if (ident != primaryIdent) {
void addCertIdentity(std::shared_ptr< SelfCert > cert, const std::string &ident)
std::unordered_map< std::string, std::shared_ptr< SelfCert > > identMap_
static std::string getKeyFromIdent(const std::string &ident)
void fizz::server::CertManager::addCertIdentity |
( |
std::shared_ptr< SelfCert > |
cert, |
|
|
const std::string & |
ident |
|
) |
| |
|
private |
Definition at line 109 of file CertManager.cpp.
References fizz::server::getKeyFromIdent(), and folly::INFO.
114 if (key.empty() || key ==
"." || key.find(
'*') != std::string::npos) {
115 throw std::runtime_error(to<std::string>(
"invalid identity: ", ident));
118 auto sigSchemes = cert->getSigSchemes();
119 auto& schemeMap =
certs_[key];
120 for (
auto sigScheme : sigSchemes) {
121 if (schemeMap.find(sigScheme) != schemeMap.end()) {
122 LOG(INFO) <<
"Skipping duplicate certificate for " << key;
124 schemeMap[sigScheme] = cert;
std::unordered_map< std::string, SigSchemeMap > certs_
static std::string getKeyFromIdent(const std::string &ident)
Definition at line 21 of file CertManager.cpp.
References folly::none.
26 auto it =
certs_.find(key);
30 for (
auto scheme : supportedSigSchemes) {
31 auto cert = it->second.find(scheme);
32 if (cert == it->second.end()) {
35 if (std::find(peerSigSchemes.begin(), peerSigSchemes.end(), scheme) !=
36 peerSigSchemes.end()) {
37 return std::make_pair(cert->second, scheme);
38 }
else if (!lastResort) {
39 lastResort = std::make_pair(cert->second, scheme);
std::unordered_map< std::string, SigSchemeMap > certs_
Select a cert given a client supplied SNI value, server supportedSigSchemes, and client peerSigSchemes.
Will ignore peerSigSchemes if no matching certificate is found.
Definition at line 45 of file CertManager.cpp.
References GCC61971::dot, sni, string, and folly::toLowerAscii().
54 auto ret =
findCert(key, supportedSigSchemes, peerSigSchemes, lastResort);
56 VLOG(8) <<
"Found exact SNI match for: " << key;
60 auto dot = key.find_first_of(
'.');
61 if (
dot != std::string::npos) {
64 wildcardKey, supportedSigSchemes, peerSigSchemes, lastResort);
66 VLOG(8) <<
"Found wildcard SNI match for: " << key;
71 VLOG(8) <<
"Did not find match for SNI: " << key;
80 VLOG(8) <<
"No matching cert for client sig schemes found";
void toLowerAscii(char *str, size_t length)
folly::Optional< std::pair< std::shared_ptr< SelfCert >, SignatureScheme >> CertMatch
CertMatch findCert(const std::string &key, const std::vector< SignatureScheme > &supportedSigSchemes, const std::vector< SignatureScheme > &peerSigSchemes, CertMatch &lastResort) const
std::shared_ptr< SelfCert > fizz::server::CertManager::getCert |
( |
const std::string & |
identity | ) |
const |
|
virtual |
Return a certificate with the a primary identity exactly matching identity. Will return nullptr if no matching cert is found.
Definition at line 84 of file CertManager.cpp.
std::unordered_map< std::string, std::shared_ptr< SelfCert > > identMap_
std::unordered_map<std::string, std::shared_ptr<SelfCert> > fizz::server::CertManager::identMap_ |
|
private |
The documentation for this class was generated from the following files: