proxygen
|
#include <OpenSSLCertUtils.h>
Static Public Member Functions | |
static Optional< std::string > | getCommonName (X509 &x509) |
static std::vector< std::string > | getSubjectAltNames (X509 &x509) |
static Optional< std::string > | getSubject (X509 &x509) |
static Optional< std::string > | getIssuer (X509 &x509) |
static std::string | getNotBeforeTime (X509 &x509) |
static std::string | getNotAfterTime (X509 &x509) |
static folly::Optional< std::string > | toString (X509 &x509) |
static X509UniquePtr | derDecode (ByteRange) |
static std::unique_ptr< IOBuf > | derEncode (X509 &) |
static std::vector< X509UniquePtr > | readCertsFromBuffer (ByteRange range) |
static std::array< uint8_t, SHA_DIGEST_LENGTH > | getDigestSha1 (X509 &x509) |
static std::array< uint8_t, SHA256_DIGEST_LENGTH > | getDigestSha256 (X509 &x509) |
static X509StoreUniquePtr | readStoreFromFile (std::string caFile) |
static X509StoreUniquePtr | readStoreFromBuffer (ByteRange range) |
Static Private Member Functions | |
static std::string | getDateTimeStr (const ASN1_TIME *time) |
Definition at line 29 of file OpenSSLCertUtils.h.
|
static |
Decode the DER representation of an X509 certificate.
Throws on error (if a valid certificate can't be decoded).
Definition at line 185 of file OpenSSLCertUtils.cpp.
References folly::test::begin(), folly::Range< Iter >::data(), and folly::Range< Iter >::size().
Referenced by TEST_P().
|
static |
Encode an X509 certificate in DER format.
Throws on error.
Definition at line 194 of file OpenSSLCertUtils.cpp.
References folly::IOBuf::create(), and dataPtr().
Referenced by fizz::server::appendClientCertificate(), fizz::test::getCertData(), and TEST_P().
|
static |
Definition at line 34 of file OpenSSLCertUtils.cpp.
References folly::portability::ssl::ASN1_STRING_get0_data(), folly::none, and string.
Referenced by ConnectionFilterTest::createDefaultOpts(), fizz::SelfCertImpl< T >::getIdentity(), fizz::PeerCertImpl< T >::getIdentity(), TestHandlerFactory::TestHandler::onEOM(), TEST_P(), validateTestCertBundle(), and validateTestCertWithSAN().
|
staticprivate |
Definition at line 166 of file OpenSSLCertUtils.cpp.
References string, and folly::detail::distributed_mutex::time().
Referenced by getNotAfterTime(), and getNotBeforeTime().
|
static |
Return the output of the X509_digest for chosen message-digest algo NOTE: The returned digest will be in binary, and may need to be hex-encoded
Definition at line 240 of file OpenSSLCertUtils.cpp.
Referenced by TEST_P().
|
static |
Definition at line 252 of file OpenSSLCertUtils.cpp.
Referenced by TEST_P().
|
static |
Definition at line 111 of file OpenSSLCertUtils.cpp.
References folly::none, and string.
Referenced by TEST_P().
|
static |
Definition at line 158 of file OpenSSLCertUtils.cpp.
References getDateTimeStr().
Referenced by TEST_P().
|
static |
Definition at line 162 of file OpenSSLCertUtils.cpp.
References getDateTimeStr().
Referenced by TEST_P().
|
static |
Definition at line 92 of file OpenSSLCertUtils.cpp.
References folly::none, and string.
Referenced by TEST_P().
|
static |
Definition at line 64 of file OpenSSLCertUtils.cpp.
References folly::portability::ssl::ASN1_STRING_get0_data(), count, i, SCOPE_EXIT, and folly::portability::ssl::STACK_OF().
Referenced by fizz::SelfCertImpl< T >::getAltIdentities(), TEST_P(), and validateTestCertWithSAN().
|
static |
Read certificates from memory and returns them as a vector of X509 pointers. Throw if there is any malformed cert or memory allocation problem.
range | Buffer to parse. |
Definition at line 209 of file OpenSSLCertUtils.cpp.
References b, folly::Range< Iter >::data(), folly::gen::move, and folly::Range< Iter >::size().
Referenced by fizz::server::test::FizzTestServer::enableClientAuthWithChain(), fizz::CertUtils::makePeerCert(), fizz::FizzUtil::readChainFile(), readStoreFromBuffer(), and TEST_P().
|
static |
Read a store from a PEM buffer. Throw if memory allocation fails, or any cert can't be parsed or added to the store.
range | A buffer containing certs in PEM format. |
Definition at line 273 of file OpenSSLCertUtils.cpp.
References readCertsFromBuffer().
Referenced by readStoreFromFile(), and TEST_P().
|
static |
Read a store from a file. Throw if unable to read the file, memory allocation fails, or any cert can't be parsed or added to the store.
caFile | Path to the CA file. |
Definition at line 264 of file OpenSSLCertUtils.cpp.
References folly::readFile(), readStoreFromBuffer(), and string.
Referenced by fizz::JavaCryptoCertificateVerifier::createFromCAFile(), fizz::DefaultCertificateVerifier::createFromCAFile(), and TEST_P().
|
static |
Definition at line 131 of file OpenSSLCertUtils.cpp.
References folly::none, and string.
Referenced by TEST_P().