return empty string in case of certificate export failure

This commit is contained in:
Adrien Béraud committed 2015-03-06 10:49:38 -05:00
1 parent 4d582dae8e
commit de92af95d3
1 file changed
+1
+1
View File
@@ -425,6 +425,7 @@ Certificate::toString() const
int err = gnutls_x509_crt_export(cert, GNUTLS_X509_FMT_PEM, &(*str.begin()), &buf_sz);
if (err != GNUTLS_E_SUCCESS) {
std::cerr << "Could not export certificate - " << gnutls_strerror(err) << std::endl;
return {};
}
str.resize(buf_sz);
return str;