Given the following PHP method below to verify that a signature is correct for specified data using the public key associated with pub_key_id. See PHP openssl_verify. What is the ruby equivalent?. I have the following PHP code snippet:
$data = $_POST['posted_data'];
$signature = base64_decode($_POST['signature']);
$public_key_id = openssl_pkey_get_public($public_key);
$verified = openssl_verify($data, $signature, $public_key_id);
openssl_free_key($key_id);
if($verified == 1)
{
echo "VERIFIED";
}
else if ($verified == 0)
{
echo "VERIFICATION FAILED";
}
else if ($verified < 0)
{
echo "ERROR";
}
I am trying to write the ruby equivalent of the program? Thanks in advance.