folly::ssl::OpenSSLCertUtils

Utilities for inspecting and encoding X509 certificates.

Synopsis

Declared in <folly/ssl/OpenSSLCertUtils.h>

class OpenSSLCertUtils;

Static Member Functions

NameDescription
asnTimeToTimepoint Converts an ASN1_TIME* into a system clock time point for use with other std::chrono classes.
derDecode Decode the DER representation of an X509 certificate.
derEncode Encode an X509 certificate in DER format.
getAllExtensions return a vector of name <-> value pairs for all extensions contaiend in the cert
getCommonName Returns the certificate's common name, if present.
getDigestSha1 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
getDigestSha256 Return the SHA-256 X509_digest of the certificate. NOTE: The returned digest will be in binary, and may need to be hex-encoded
getExtendedKeyUsage Return the Extended Key Usage (EKU) entries, if any, from the cert. Each entry is a dotted-decimal OID string (e.g., "1.3.6.1.5.5.7.3.1").
getExtension Get a set of strings containing data for a given cert extension
getIssuer Return the issuer name, if any, from the cert
getIssuerCommonName Returns the issuer's common name, if present.
getNotAfterTime Get a string representation of the not-after (expiration) time
getNotBeforeTime Get a string representation of the not-before time on the certificate
getSubject Return the subject name, if any, from the cert
getSubjectAltNameEntries Returns DNS name, URI, and IP address subjectAltName entries in certificate order. Other GENERAL_NAME types are ignored.
getSubjectAltNameURIs Returns URI subjectAltName entries in certificate order.
getSubjectAltNames Returns DNS name subjectAltName entries in certificate order.
pemDecode Decode the PEM representation of an X509 certificate.
pemEncode Encode an X509 certificate in PEM format.
readCertsFromBuffer Read certificates from memory and returns them as a vector of X509 pointers. Throw if there is any malformed cert or memory allocation problem.
readStoreFromBuffer Read a store from a PEM buffer. Throw if memory allocation fails, or any cert can't be parsed or added to the store.
readStoreFromFile 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.
toString Summarize the CN, Subject, Issuer, Validity, and extensions as a string