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

crypto: don't build getLongID() with old gnutls

parent 9d75ed14
No related branches found
No related tags found
No related merge requests found
...@@ -83,7 +83,9 @@ struct OPENDHT_PUBLIC PublicKey ...@@ -83,7 +83,9 @@ struct OPENDHT_PUBLIC PublicKey
PublicKey& operator=(PublicKey&& o) noexcept; PublicKey& operator=(PublicKey&& o) noexcept;
InfoHash getId() const; InfoHash getId() const;
#if GNUTLS_VERSION_NUMBER >= 0x030401
PkId getLongId() const; PkId getLongId() const;
#endif
bool checkSignature(const Blob& data, const Blob& signature) const; bool checkSignature(const Blob& data, const Blob& signature) const;
Blob encrypt(const Blob&) const; Blob encrypt(const Blob&) const;
...@@ -362,7 +364,9 @@ struct OPENDHT_PUBLIC Certificate { ...@@ -362,7 +364,9 @@ struct OPENDHT_PUBLIC Certificate {
/** Same as getPublicKey().getId() */ /** Same as getPublicKey().getId() */
InfoHash getId() const; InfoHash getId() const;
#if GNUTLS_VERSION_NUMBER >= 0x030401
PkId getLongId() const; PkId getLongId() const;
#endif
/** Read certificate Common Name (CN) */ /** Read certificate Common Name (CN) */
std::string getName() const; std::string getName() const;
......
...@@ -51,10 +51,11 @@ public: ...@@ -51,10 +51,11 @@ public:
InfoHash getId() const { InfoHash getId() const {
return key_ ? key_->getPublicKey().getId() : InfoHash(); return key_ ? key_->getPublicKey().getId() : InfoHash();
} }
#if GNUTLS_VERSION_NUMBER >= 0x030401
PkId getLongId() const { PkId getLongId() const {
return key_ ? key_->getPublicKey().getLongId() : PkId(); return key_ ? key_->getPublicKey().getLongId() : PkId();
} }
#endif
ValueType secureType(ValueType&& type); ValueType secureType(ValueType&& type);
ValueType secureType(const ValueType& type) { ValueType secureType(const ValueType& type) {
......
...@@ -532,6 +532,7 @@ PublicKey::getId() const ...@@ -532,6 +532,7 @@ PublicKey::getId() const
return id; return id;
} }
#if GNUTLS_VERSION_NUMBER >= 0x030401
PkId PkId
PublicKey::getLongId() const PublicKey::getLongId() const
{ {
...@@ -541,6 +542,7 @@ PublicKey::getLongId() const ...@@ -541,6 +542,7 @@ PublicKey::getLongId() const
return {}; return {};
return h; return h;
} }
#endif
Certificate::Certificate(const Blob& certData) : cert(nullptr) Certificate::Certificate(const Blob& certData) : cert(nullptr)
{ {
...@@ -646,6 +648,7 @@ Certificate::getId() const ...@@ -646,6 +648,7 @@ Certificate::getId() const
return id; return id;
} }
#if GNUTLS_VERSION_NUMBER >= 0x030401
PkId PkId
Certificate::getLongId() const Certificate::getLongId() const
{ {
...@@ -657,6 +660,7 @@ Certificate::getLongId() const ...@@ -657,6 +660,7 @@ Certificate::getLongId() const
throw CryptoException("Can't get certificate public key ID."); throw CryptoException("Can't get certificate public key ID.");
return id; return id;
} }
#endif
static std::string static std::string
getDN(gnutls_x509_crt_t cert, const char* oid, bool issuer = false) getDN(gnutls_x509_crt_t cert, const char* oid, bool issuer = false)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment