Decrypt RIJNDAEL-128 in Java

306 views Asked by At

I have encrypted text using Crypt function in Laravel. I am using cipher - MCRYPT_RIJNDAEL_128 and CBC. How can I decrypt in Java? Here is the code of decryption in Laravel/PHP

$payload = json_encode(base64_decode($payload), true);
$value = base64_decode($payload['value']);
$iv = base64_decode($payload['iv']);
return unserialize($this->stripPadding($this->mcryptDecrypt($value, $iv)));

protected function mcryptDecrypt($value, $iv)
    {
        try
        {
            return mcrypt_decrypt($this->cipher, $this->key, $value, $this->mode, $iv);
        }
        catch (Exception $e)
        {
            throw new DecryptException($e->getMessage());
        }
    }
0

There are 0 answers