public function decrypt($data, $algorithm, $iv, $key)
{
if (!function_exists('openssl_encrypt')) {
throw new \RuntimeException('Cannot encrypt data, OpenSSL not enabled');
}
// Decrypt just the claims
$sections = explode('.', $data);
if (count($sections) < 3) {
throw new Exception\DecodeException('Invalid number of sections (<3)');
}
$claims = openssl_decrypt($this->base64Decode($sections[1]), $algorithm, $key, false, $iv);
return json_decode($claims);
}