3

I have a class which in C# doing RSA encryption where I used the default RSACryptoServiceProvider class. But I have a concern regarding the following; If you have the word hello for an input and the encrypted string is returned as ABCDE, if you perform another encrypt operation on the input hello, using the same keys (public and private) for the RSA will the output be again ABCDE?

Thanks in advance

JUST MY correct OPINION
  • 35,674
  • 17
  • 77
  • 99
Ryan
  • 265
  • 1
  • 6
  • 17

1 Answers1

5

Indeed, RSA is a deterministic encryption algorithm, so given the same keys and plaintext, the same cryptotext will be outputted. RSA is commonly used with a padding scheme to be semantically secure.

This is of course only the general case. I can't vouch for the RSACryptoServiceProvider in C#

Edit:

Of course, your chosen padding scheme needs to be pretty pseudorandom as well. OAEP is one commonly used.

mikek
  • 1,555
  • 17
  • 30
  • Worth noting is that due to this, RSA is vulnerable to statistical analysis if an attacker has enough data and the data is not padded. For this reason protocols such as SSH use RSA for authentication and a different algorithm for data encryption. – Simon Lindgren Mar 14 '10 at 09:23
  • But is the padding scheme deterministic as well? – H H Mar 14 '10 at 09:49
  • @Henk Holterman: That would be kind of silly, wouldn't it? :P – mikek Mar 15 '10 at 08:31
  • I thought so. But what does that mean for the original question? – H H Mar 15 '10 at 09:31