diff --git a/include/opendht/crypto.h b/include/opendht/crypto.h index 59a9eb23ef5ab1b0276abd4bb1062c43341a21a4..dcda08c8c39f022ca4d3f892b21cc38303c029f5 100644 --- a/include/opendht/crypto.h +++ b/include/opendht/crypto.h @@ -227,6 +227,12 @@ public: time_point getNextUpdateTime() const; 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: gnutls_x509_crl_t crl {}; @@ -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); + 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 {}; std::shared_ptr<Certificate> issuer {}; private: