CSharp-easy-RSA-PEM icon indicating copy to clipboard operation
CSharp-easy-RSA-PEM copied to clipboard

The data to be decrypted exceeds the maximum for this modulus of 256 bytes.

Open kmajeed opened this issue 7 years ago • 0 comments

Hi

I am trying to decrypt cipher text using a key which was given to me. The key is in PEM format. It looks like

-----BEGIN RSA PRIVATE KEY-----
XXXX Removed this content XXXX
-----END RSA PRIVATE KEY-----

The cipher text if of length 512 chars (Base64). The length of my private key is 1588 chars (Base64)/2048 in bytes. When trying to decrypt this cipher text with private key the function:

byte[] DecryptBytes(string inputString, RSACryptoServiceProvider key)

throws the following exception,

The data to be decrypted exceeds the maximum for this modulus of 256 bytes.

FYI, by putting a breakpoint I can see that the base64BlockSize = 258 bytes Can you please assist me in fixing this problem?

kmajeed avatar Mar 04 '17 17:03 kmajeed