I need to be able to craft JSON Web Token signatures (which only accepts 'RSASSA-PKCS1-V1_5-SIGN with the SHA-256 hash function' signatures), but the obvious CPAN contender for this task (Crypt::RSA) will only generate signatures using MD2, MD5 or SHA1.
Is there another library somewhere that will do what I want? If necessary I should be able to do a bit of hacking to get there, but that wouldn't be too pretty.
I was able to find a module that did what I wanted: Crypt::OpenSSL::RSA
my $rsa = Crypt::OpenSSL::RSA->new_private_key($key);
$rsa->use_sha256_hash;
my $signature = $rsa->sign($message);
So much easier than extending Crypt::RSA, but it was oddly kind of difficult to find.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With