本文介绍了是否有perl实现的SHA256withRSA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要能够创建JSON Web令牌签名(只接受 signatures),但是这个任务的明显CPAN竞争者()只会使用。



有什么另一个图书馆在哪里,会做我想要什么?

解决方案

如果需要,我应该能够做一些黑客来到那里,但这不会太漂亮。我可以找到一个我想要的模块:

  my $ rsa = Crypt :: OpenSSL :: RSA-> new_private_key($ key); 
$ rsa-> use_sha256_hash;
my $ signature = $ rsa-> sign($ message);

比扩展Crypt :: RSA容易得多,但很奇怪。 / p>

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.

这篇关于是否有perl实现的SHA256withRSA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 13:11