diff --git a/include/opendht/securedht.h b/include/opendht/securedht.h
index f73e5a1d13766df55e5826a892ec177654fcdea5..19e3d24856ce326ad0820b81aaf4af615854b1a6 100644
--- a/include/opendht/securedht.h
+++ b/include/opendht/securedht.h
@@ -378,7 +378,7 @@ const ValueType CERTIFICATE_TYPE = {
         try {
             crypto::Certificate crt(v->data);
             // TODO check certificate signature
-            return crt.getPublicKey().getId() == id;
+            return crt.getPublicKey().getId() == id || InfoHash::get(crt.getPublicKey().getLongId()) == id;
         } catch (const std::exception& e) {}
         return false;
     },