Certificate: add option to not export the whole chain

This commit is contained in:
cberaud committed 2015-04-30 22:02:27 -04:00
1 parent 892af7a843
commit 06a32eedd1
2 files changed
+6 -3

No files matched your search

+3 -2
View File
@@ -185,9 +185,10 @@ struct Certificate : public Serializable {
std::string getIssuerUID() const;
/**
* PEM encoded certificate
* PEM encoded certificate.
* If chain is true, the issuer chain will be included (default).
*/
std::string toString() const;
std::string toString(bool chain = true) const;
gnutls_x509_crt_t cert {};
std::shared_ptr<Certificate> issuer {};
+3 -1
View File
@@ -447,7 +447,7 @@ Certificate::getIssuerUID() const
}
std::string
Certificate::toString() const
Certificate::toString(bool chain) const
{
std::ostringstream ss;
const Certificate* crt = this;
@@ -461,6 +461,8 @@ Certificate::toString() const
}
str.resize(buf_sz);
ss << str;
if (not chain)
break;
crt = crt->issuer.get();
}
return ss.str();