From 8dacf142787bdac69ab565e983d4f392c70792d2 Mon Sep 17 00:00:00 2001
From: Adrien Beraud <adrien.beraud@savoirfairelinux.com>
Date: Tue, 28 Mar 2017 23:54:03 +0200
Subject: [PATCH] crypto: add Certificate::getRawCopy()

---
 include/opendht/crypto.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/opendht/crypto.h b/include/opendht/crypto.h
index 59a9eb23..c4e2ba29 100644
--- a/include/opendht/crypto.h
+++ b/include/opendht/crypto.h
@@ -399,6 +399,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 getRawCopy() 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:
-- 
GitLab