- node->decrypt_attempted = true;
- if (! node->decrypted_child)
- node->decrypted_child = _notmuch_crypto_decrypt (cryptoctx, encrypteddata, &decrypt_result, &err);
+ if (! node->decrypted_child) {
+ for (mime_node_t *parent = node; parent; parent = parent->parent)
+ if (parent->envelope_file) {
+ message = parent->envelope_file;
+ break;
+ }
+
+ node->decrypted_child = _notmuch_crypto_decrypt (&node->decrypt_attempted,
+ node->ctx->crypto->decrypt,
+ message,
+ cryptoctx, encrypteddata, &decrypt_result, &err);
+ }