From e9adff9dc52ad485d902dec6d1633ff366eb1cc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Wed, 30 Nov 2016 17:30:09 -0500 Subject: [PATCH] crypto: add CRL move operator, export as DER --- include/opendht/crypto.h | 3 +++ src/crypto.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/opendht/crypto.h b/include/opendht/crypto.h index 9bba9ffd..d4cf548e 100644 --- a/include/opendht/crypto.h +++ b/include/opendht/crypto.h @@ -327,8 +327,11 @@ class OPENDHT_PUBLIC RevocationList public: RevocationList(); RevocationList(const Blob& b); + RevocationList(RevocationList&& o) : crl(o.crl) { o.crl = nullptr; } ~RevocationList(); + RevocationList& operator=(RevocationList&& o) { crl = o.crl; o.crl = nullptr; return *this; } + void pack(Blob& b) const; void unpack(const uint8_t* dat, size_t dat_size); Blob getPacked() const { diff --git a/src/crypto.cpp b/src/crypto.cpp index 4a3c13c6..fc1fedba 100644 --- a/src/crypto.cpp +++ b/src/crypto.cpp @@ -865,7 +865,7 @@ void RevocationList::pack(Blob& b) const { gnutls_datum_t gdat {nullptr, 0}; - if (auto err = gnutls_x509_crl_export2(crl, GNUTLS_X509_FMT_PEM, &gdat)) { + if (auto err = gnutls_x509_crl_export2(crl, GNUTLS_X509_FMT_DER, &gdat)) { throw CryptoException(std::string("Can't export CRL: ") + gnutls_strerror(err)); } b.insert(b.end(), gdat.data, gdat.data + gdat.size); -- GitLab