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

crypto: add Certificate::getCopy()

parent 4540be74
No related branches found
No related tags found
No related merge requests found
...@@ -227,6 +227,12 @@ public: ...@@ -227,6 +227,12 @@ public:
time_point getNextUpdateTime() const; time_point getNextUpdateTime() const;
gnutls_x509_crl_t get() { return crl; } gnutls_x509_crl_t get() { return crl; }
gnutls_x509_crl_t getCopy() const {
auto copy = RevocationList(getPacked());
gnutls_x509_crl_t ret = copy.crl;
copy.crl = nullptr;
return ret;
}
private: private:
gnutls_x509_crl_t crl {}; gnutls_x509_crl_t crl {};
...@@ -399,6 +405,13 @@ struct OPENDHT_PUBLIC Certificate { ...@@ -399,6 +405,13 @@ struct OPENDHT_PUBLIC Certificate {
static Certificate generate(const PrivateKey& key, const std::string& name = "dhtnode", Identity ca = {}, bool is_ca = false); static Certificate generate(const PrivateKey& key, const std::string& name = "dhtnode", Identity ca = {}, bool is_ca = false);
gnutls_x509_crt_t getCopy() const {
auto copy = Certificate(getPacked());
gnutls_x509_crt_t ret = copy.cert;
copy.cert = nullptr;
return ret;
}
gnutls_x509_crt_t cert {}; gnutls_x509_crt_t cert {};
std::shared_ptr<Certificate> issuer {}; std::shared_ptr<Certificate> issuer {};
private: private:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment