kobi7
kobi7

Reputation: 961

.NET: puzzling cryptographic exception in RsaCryptoServiceProvider

I get a cryptographic exception in the following code, and the exception states: invalid flags specified

RSACryptoServiceProvider rsa = new RSACryptoServiceProvider((int)strength);
rsa.Encrypt(new byte[] { 0, 1, 2, 3, 4, 5, 7 }, false); // forcing the key to generate

I have tried to set cspParameters but there is no difference. I think it only happens when I set a large bitsize. (strength value)

Upvotes: 0

Views: 300

Answers (1)

kobi7
kobi7

Reputation: 961

Never mind, the source of the problem was that I set it to a value larger than 16384. (which is the max bitsize for RSA in dot net).

Upvotes: 1

Related Questions