struct rspamd_cryptobox_pubkey *rk;
struct fuzzy_key *key = NULL;
- if (s->ctx->default_key == NULL) {
+ if (s->ctx->default_key == NULL && s->ctx->dynamic_keys == NULL) {
msg_warn("received encrypted request when encryption is not enabled");
return FALSE;
}
key = kh_val(s->ctx->keys, k);
}
+ if (key == NULL) {
+ /* Cannot find any suitable decryption key */
+ msg_debug("cannot find suitable decryption key");
+ return FALSE;
+ }
+
/* Now process the remote pubkey */
rk = rspamd_pubkey_from_bin(hdr.pubkey, sizeof(hdr.pubkey),
RSPAMD_KEYPAIR_KEX, RSPAMD_CRYPTOBOX_MODE_25519);