* limitations under the License.
*/
#include <folly/ssl/OpenSSLCertUtils.h>
-#include <folly/String.h>
-#include <folly/io/async/ssl/OpenSSLPtrTypes.h>
-
-#include <openssl/x509.h>
-#include <openssl/x509v3.h>
#include <folly/ScopeGuard.h>
+#include <folly/String.h>
+#include <folly/ssl/OpenSSLPtrTypes.h>
namespace folly {
namespace ssl {
return none;
}
- auto cnData = reinterpret_cast<const char*>(ASN1_STRING_data(cnAsn));
+ auto cnData = reinterpret_cast<const char*>(ASN1_STRING_get0_data(cnAsn));
auto cnLen = ASN1_STRING_length(cnAsn);
if (!cnData || cnLen <= 0) {
return none;
if (!genName || genName->type != GEN_DNS) {
continue;
}
- auto nameData =
- reinterpret_cast<const char*>(ASN1_STRING_data(genName->d.dNSName));
+ auto nameData = reinterpret_cast<const char*>(
+ ASN1_STRING_get0_data(genName->d.dNSName));
auto nameLen = ASN1_STRING_length(genName->d.dNSName);
if (!nameData || nameLen <= 0) {
continue;
throw std::runtime_error("Cannot allocate bio");
}
- if (X509_print_ex(
- in.get(),
- &x509,
- XN_FLAG_ONELINE,
- X509_FLAG_NO_HEADER | /* A few bytes of cert and data */
- X509_FLAG_NO_PUBKEY | /* Public key */
- X509_FLAG_NO_IDS | /* Issuer/subject IDs */
- X509_FLAG_NO_AUX | /* Auxiliary info? */
- X509_FLAG_NO_SIGDUMP | /* Prints the signature */
- X509_FLAG_NO_SIGNAME /* Signature algorithms */
- ) > 0) {
+ int flags = 0;
+
+ flags |= X509_FLAG_NO_HEADER | /* A few bytes of cert and data */
+ X509_FLAG_NO_PUBKEY | /* Public key */
+ X509_FLAG_NO_AUX | /* Auxiliary info? */
+ X509_FLAG_NO_SIGDUMP | /* Prints the signature */
+ X509_FLAG_NO_SIGNAME; /* Signature algorithms */
+
+#ifdef X509_FLAG_NO_IDS
+ flags |= X509_FLAG_NO_IDS; /* Issuer/subject IDs */
+#endif
+
+ if (X509_print_ex(in.get(), &x509, XN_FLAG_ONELINE, flags) > 0) {
char* bioData = nullptr;
size_t bioLen = BIO_get_mem_data(in.get(), &bioData);
return std::string(bioData, bioLen);
return "";
}
- std::array<char, 32> buf;
-
auto bio = BioUniquePtr(BIO_new(BIO_s_mem()));
if (bio == nullptr) {
throw std::runtime_error("Cannot allocate bio");