Skip to content
Snippets Groups Projects
Commit c37f0083 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

crypto: add CertificateRequest::toString

parent 29e7768c
No related branches found
No related tags found
No related merge requests found
......@@ -283,6 +283,7 @@ public:
bool verify() const;
Blob pack() const;
std::string toString() const;
gnutls_x509_crq_t get() const { return request; }
private:
......
......@@ -703,6 +703,17 @@ CertificateRequest::pack() const
return ret;
}
std::string
CertificateRequest::toString() const
{
gnutls_datum_t dat {nullptr, 0};
if (auto err = gnutls_x509_crq_export2(request, GNUTLS_X509_FMT_PEM, &dat))
throw CryptoException(std::string("Can't export certificate request: ") + gnutls_strerror(err));
std::string ret(dat.data, dat.data + dat.size);
gnutls_free(dat.data);
return ret;
}
// Certificate
static std::string
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment