mirror of
https://github.com/matrix-construct/construct
synced 2024-06-10 22:18:54 +02:00
ircd::openssl: Convenience to print information about an X509 from a PEM.
This commit is contained in:
parent
3d8d6f47b4
commit
8c869e3ee5
|
@ -91,8 +91,9 @@ namespace ircd::openssl
|
|||
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 &, ulong flags = -1);
|
||||
string_view subject_common_name(const mutable_buffer &out, const X509 &);
|
||||
string_view printX509(const mutable_buffer &buf, const string_view &pem, ulong flags = -1);
|
||||
string_view genX509(const mutable_buffer &out, const json::object &opts);
|
||||
string_view subject_common_name(const mutable_buffer &out, const X509 &);
|
||||
const X509 &peer_cert(const SSL &);
|
||||
X509 &peer_cert(SSL &);
|
||||
|
||||
|
|
|
@ -336,6 +336,20 @@ ircd::openssl::subject_common_name(const mutable_buffer &out,
|
|||
return { data(out), size_t(len) };
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::openssl::printX509(const mutable_buffer &buf,
|
||||
const string_view &pem,
|
||||
ulong flags)
|
||||
{
|
||||
const custom_ptr<X509> x509
|
||||
{
|
||||
X509_new(),
|
||||
[](X509 *const x509) { X509_free(x509); }
|
||||
};
|
||||
|
||||
return print(buf, read_pem(*x509, pem), flags);
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::openssl::print(const mutable_buffer &buf,
|
||||
const X509 &cert,
|
||||
|
|
Loading…
Reference in a new issue