diff --git a/include/ircd/openssl.h b/include/ircd/openssl.h index 735642862..085449dec 100644 --- a/include/ircd/openssl.h +++ b/include/ircd/openssl.h @@ -90,7 +90,7 @@ namespace ircd::openssl const_raw_buffer cert2d(const mutable_raw_buffer &out, const string_view &pem); X509 &read_pem(X509 &out, const string_view &pem); string_view write_pem(const mutable_buffer &out, const X509 &); - string_view print(const mutable_buffer &buf, const X509 &); + string_view print(const mutable_buffer &buf, const X509 &, ulong flags = -1); string_view subject_common_name(const mutable_buffer &out, const X509 &); string_view genX509(const mutable_buffer &out, const json::object &opts); const X509 &peer_cert(const SSL &); diff --git a/ircd/openssl.cc b/ircd/openssl.cc index fe59a9d7d..9810d715a 100644 --- a/ircd/openssl.cc +++ b/ircd/openssl.cc @@ -338,12 +338,18 @@ ircd::openssl::subject_common_name(const mutable_buffer &out, ircd::string_view ircd::openssl::print(const mutable_buffer &buf, - const X509 &cert) + const X509 &cert, + ulong flags) { - return bio::write(buf, [&cert] + if(flags == ulong(-1)) + flags = XN_FLAG_ONELINE; + else + flags = 0; + + return bio::write(buf, [&cert, &flags] (BIO *const &bio) { - X509_print(bio, const_cast(&cert)); + X509_print_ex(bio, const_cast(&cert), 0, flags); }); }