mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 07:23:53 +01:00
ircd::openssl: Add flags to the X509 printer.
This commit is contained in:
parent
29b135de0a
commit
37b98b5a82
2 changed files with 10 additions and 4 deletions
|
@ -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 &);
|
||||
|
|
|
@ -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<X509 *>(&cert));
|
||||
X509_print_ex(bio, const_cast<X509 *>(&cert), 0, flags);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue