Decryption failed because the HMAC could not be validated while decrypt
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 :)