diff --git a/include/opendht/dhtrunner.h b/include/opendht/dhtrunner.h
index 31d3ae26834fed2174c836a320365c46446b8e47..476953814b8d774bfb64065c98889f4ab82246e2 100644
--- a/include/opendht/dhtrunner.h
+++ b/include/opendht/dhtrunner.h
@@ -303,6 +303,7 @@ public:
      * Get the public key fingerprint if an identity is used with this node, 0 otherwise.
      */
     InfoHash getId() const;
+    std::shared_ptr<crypto::PublicKey> getPublicKey() const;
 
     /**
      * Get the ID of the DHT node.
diff --git a/src/dhtrunner.cpp b/src/dhtrunner.cpp
index b43854bed771ba42034c9a96f5fc2ea96103393d..a145d4f3313e2afa4322d34279d5fd5bd16e6006 100644
--- a/src/dhtrunner.cpp
+++ b/src/dhtrunner.cpp
@@ -406,6 +406,14 @@ DhtRunner::getId() const
     return {};
 }
 
+std::shared_ptr<crypto::PublicKey>
+DhtRunner::getPublicKey() const
+{
+    if (auto dht = activeDht())
+        return dht->getPublicKey();
+    return {};
+}
+
 InfoHash
 DhtRunner::getNodeId() const
 {