是否可以使用 RsaCryptoServiceProvider 调用 SignHash 和VerifyHash,而无需昂贵的 OID 查找?
我需要使用 RSA(密钥大小 1024 位)每秒签署和验证大约一百条消息。
为了对消息进行签名,我使用 SHA2 计算数据的哈希值,然后将哈希值传递给 SignHash。
rsaCryptoServiceProvider.SignHash(hashOfData, "SHA2");
为了验证签名,我使用
rsaCryptoServiceProvider.VerifyHash(hashOfData, "SHA2", signature);
使用 null 调用这些方法会引发异常。同样,使用
CryptoConfig.MapNameToOid("SHA2")
也会联系域控制器并花费大量时间。
我也尝试过使用 SHA1 和 MD5 进行相同的操作。有什么方法可以跳过 SignHash 和VerifyHash 的 OID 查找吗?
I need to sign and verify around a hundred messages / sec using RSA (Key size 1024 bit).
For signing the message I am calculating the hash of the data using SHA2 and then passing the hash to SignHash.
rsaCryptoServiceProvider.SignHash(hashOfData, "SHA2");
To verify the signature I use
rsaCryptoServiceProvider.VerifyHash(hashOfData, "SHA2", signature);
Calling these methods with null throws an exception. Similarly, using
CryptoConfig.MapNameToOid("SHA2")
also contacts the domain controller and takes a lot of time.
I have tried the same with SHA1 and MD5 too. Is there any way I can skip the OID lookup for both SignHash and VerifyHash?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
似乎传递 null 作为第二个参数会强制使用 SHA1。使用任何其他算法都需要 Oid 查找。
It seems that passing null as the second parameter forces the use of SHA1. Using any other algorithm requires a Oid lookup.