RSA encryption without padding C#

2019-02-28 05:42发布

问题:

I'll set the scene,

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.

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?

I'm currently looking at OpenSSL.Net as an alternative, but are there others which are better/

Any help would be appriciated. Thanks.

回答1:

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.

I believe Mono.Security (you can use it on normal .net) contains classes that support unpadded RSA.



标签: c# rsa padding