RSA加密,无需填充C# [英] RSA encryption without padding C#
问题描述
我将设置场景,
我需要使用512位密钥在给定的一组字节上计算RSA加密.使用RSACryptoServiceProvider类可以轻松实现这一点,但是在计算RSA加密之前,我需要预先计算用于加密的自定义填充.
I'm required to compute RSA encryption on a given set of bytes using a 512 bit key. This can be achieved easily with the RSACryptoServiceProvider class, however I'm required to precompute custom padding for the encryption prior to computing the RSA encryption.
此自定义填充不符合RSACryptoServiceProvider的Encrypt方法中提供的PKCS#1 v1.5或v2.是否可以使用其他C#类来计算RSA加密而无需添加自己的填充?
This custom padding does not conform with the PKCS#1 v1.5 or v2 provided in the RSACryptoServiceProvider's Encrypt method. Are there any alternatives C# classes that I could use to compute the RSA Encryption without adding their own padding?
我目前正在寻找OpenSSL.Net作为替代方案,但是还有其他更好的方案/
I'm currently looking at OpenSSL.Net as an alternative, but are there others which are better/
将寻求任何帮助. 谢谢.
Any help would be appriciated. Thanks.
推荐答案
原则上,您可以使用ModPow
在BigInteger
上自己实现它.但这将相对较慢,并且对于私钥操作而言,它很容易计时出边信道攻击.
In principle you could implement it yourself on BigInteger
using ModPow
. But that will be relatively slow, and for private key operations it's wide open to timing side-channel attacks.
我相信Mono.Security
(您可以在普通.net上使用它)包含支持未填充RSA的类.
I believe Mono.Security
(you can use it on normal .net) contains classes that support unpadded RSA.
这篇关于RSA加密,无需填充C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!