S
Sushant Bhatia
Hi All,
I am trying to do encryption/decryption with RSA.
For encryption, I use the public key. For decryption, I use the private
key. The idea is to take a 80 byte array and encrypt it and then
decrypt that result to get the original 80 byte array. However, when I
do the decryption I am getting a "Error occurred while decoding OAEP
padding." CryptoGraphicException.
byte[] RSAResult = RSA.Encrypt(dataToDecrypt,true);
encryptedData = rsaCSP.Decrypt(dataToEncrypt, true);
I have tried using false for the OAEP parameter (all combinations) but
that only gets bad key or bad data exceptions. I looked on google and I
didn't find too much on this topic except an article suggesting having
the same size buffer which I did keep the same size.
The wierd thing is that I am doing the exact same piece of code at the
beginning of my program and it works. This code is called again in the
middle of my app and it fails. Too wierd.
Any ideas or suggestions?
Thanks guys.
Sushant Bhatia
I am trying to do encryption/decryption with RSA.
For encryption, I use the public key. For decryption, I use the private
key. The idea is to take a 80 byte array and encrypt it and then
decrypt that result to get the original 80 byte array. However, when I
do the decryption I am getting a "Error occurred while decoding OAEP
padding." CryptoGraphicException.
byte[] RSAResult = RSA.Encrypt(dataToDecrypt,true);
encryptedData = rsaCSP.Decrypt(dataToEncrypt, true);
I have tried using false for the OAEP parameter (all combinations) but
that only gets bad key or bad data exceptions. I looked on google and I
didn't find too much on this topic except an article suggesting having
the same size buffer which I did keep the same size.
The wierd thing is that I am doing the exact same piece of code at the
beginning of my program and it works. This code is called again in the
middle of my app and it fails. Too wierd.
Any ideas or suggestions?
Thanks guys.
Sushant Bhatia