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

crypto: add getChain()

parent f41c8fef
Branches
Tags
No related merge requests found
......@@ -411,6 +411,18 @@ struct OPENDHT_PUBLIC Certificate {
return ret;
}
std::vector<gnutls_x509_crt_t>
getChain(bool copy = false) const
{
std::vector<gnutls_x509_crt_t> crts;
auto c = this;
do {
crts.emplace_back(copy ? c->getCopy() : c->cert);
c = c->issuer.get();
} while (c);
return crts;
}
gnutls_x509_crt_t cert {};
std::shared_ptr<Certificate> issuer {};
private:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment