Decryption failed because the HMAC could not be validated while decrypt I am using the Encrypt module to encrypt some of user object data. 

I can encrypt data, but while decrypt it, I get the following error:


  Decryption failed because the HMAC could not be validated


encrypt('name') // It works.
decrypt('some encrypted data') // It throws the above error.


How can I decrypt data using that module?
I have found below solution. I have un-serialized encrypted data. Found below details.



Used above input to decrypt function.

$options = array();
$method = 'mcrypt_aes_cbc';
$key_provider = 'drupal_variable';
$config = array('provider_settings' =&gt; array('method' =&gt; 'variable_contents')); // I have updated method name later.
decrypt('encrypted_text', $options, $method, $key_provider, $config); // It works now :)