diff --git a/include/opendht/value.h b/include/opendht/value.h
index 33d335cf0427c99b886bd9a3eb9c1d0c33bcf947..365514d5604dbdf3dc06b7ccbdb8dd2a19733520 100644
--- a/include/opendht/value.h
+++ b/include/opendht/value.h
@@ -625,6 +625,12 @@ struct OPENDHT_PUBLIC Value
      */
     unsigned priority {0};
 
+    inline bool isSignatureChecked() const {
+        return signatureChecked;
+    }
+    inline bool isDecrypted() const {
+        return decrypted;
+    }
     bool checkSignature();
     Sp<Value> decrypt(const crypto::PrivateKey& key);
 
diff --git a/src/securedht.cpp b/src/securedht.cpp
index 28fdee0aa3fac23636aff26a85fac86d4c657427..03f9490d8b3f360a9663ca3f913a81438e58efde 100644
--- a/src/securedht.cpp
+++ b/src/securedht.cpp
@@ -238,8 +238,10 @@ SecureDht::checkValue(const Sp<Value>& v)
             return {};
         }
         try {
+            auto isDecrypted = v->isDecrypted();
             if (auto decrypted_val = v->decrypt(*key_)) {
-                if (decrypted_val->owner)
+                auto cacheValue = not isDecrypted and decrypted_val->owner;
+                if (cacheValue)
                     nodesPubKeys_[decrypted_val->owner->getId()] = decrypted_val->owner;
                 return decrypted_val;
             }
@@ -250,8 +252,9 @@ SecureDht::checkValue(const Sp<Value>& v)
     }
     // Check signed values
     else if (v->isSigned()) {
+        auto cacheValue = not v->isSignatureChecked() and enableCache_ and v->owner;
         if (v->checkSignature()) {
-            if (enableCache_ and v->owner)
+            if (cacheValue)
                 nodesPubKeys_[v->owner->getId()] = v->owner;
             return v;
         } else if (logger_)