|
static void | getSSLCtxExIndex (int *pindex) |
|
static void | getRSAExIndex (int *pindex) |
|
static int | exDataStdStringDup (CRYPTO_EX_DATA *, ex_data_dup_from_arg_t, ex_data_dup_ptr_arg_t ptr, int, long, void *) |
|
static void | exDataStdStringFree (void *, void *ptr, CRYPTO_EX_DATA *, int, long, void *) |
|
static void | getSSLSessionExStrIndex (int *pindex) |
|
static std::string | hexlify (const std::string &binary) |
|
static const std::string & | hexlify (const std::string &binary, std::string &hex) |
|
static SSLResumeEnum | getResumeState (folly::AsyncSSLSocket *sslSocket) |
|
static std::unique_ptr< std::string > | getCommonName (const X509 *cert) |
|
static std::unique_ptr< std::list< std::string > > | getSubjectAltName (const X509 *cert) |
|
static folly::ssl::X509UniquePtr | getX509FromCertificate (const std::string &certificateData) |
|
Definition at line 65 of file SSLUtil.h.
std::unique_ptr< std::list< std::string > > wangle::SSLUtil::getSubjectAltName |
( |
const X509 * |
cert | ) |
|
|
static |
Get the Subject Alternative Name value(s) from an X.509 certificate
- Parameters
-
cert | certificate to inspect |
- Returns
- set of zero or more alternative names, or null if an error occurs
Definition at line 70 of file SSLUtil.cpp.
References folly::portability::ssl::ASN1_STRING_get0_data(), count, folly::gen::guard(), i, folly::makeGuard(), max, name, and s.
Referenced by wangle::SSLContextManager::addSSLContextConfig(), and wangle::SSLContextManager::insert().
73 auto nameList = std::make_unique<std::list<std::string>>();
74 GENERAL_NAMES* names = (GENERAL_NAMES*)X509_get_ext_d2i(
75 (X509*)cert, NID_subject_alt_name,
nullptr,
nullptr);
78 size_t count = sk_GENERAL_NAME_num(names);
80 for (
int i = 0;
i < (int)count; ++
i) {
81 GENERAL_NAME* generalName = sk_GENERAL_NAME_value(names,
i);
82 if (generalName->type == GEN_DNS) {
83 ASN1_STRING*
s = generalName->d.dNSName;
87 auto len = ASN1_STRING_length(s);
89 if (
size_t(len) != strlen(name)) {
94 nameList->emplace_back(name);
unsigned char * ASN1_STRING_get0_data(const ASN1_STRING *x)
GuardImpl guard(ErrorHandler &&handler)
FOLLY_NODISCARD detail::ScopeGuardImplDecay< F, true > makeGuard(F &&f) noexcept(noexcept(detail::ScopeGuardImplDecay< F, true >(static_cast< F && >(f))))