RSA Encrypt/Decrypt with OAEP.

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
 
V

Valery Pryamikov

Sushant,
You should not cross-post your questions. And you should never cross-post
your question in so many groups!

From the description you gave, I'm quite confident that its just a bug in
your own code. However I'll refrain from further conversation on that
subject as long as it will be cross-posted.

-Valery.
http://www.harper.no/valery
 
S

Sushant Bhatia

Damn. I see why you said cross posting is bad. All posts to this one
thread are going to all the threads and its becoming big. Sorry google
groups. I'm trying to do an individual reply to this post only so that
the rest of them just die out.


Ps. Still looking for any suggestions to my wierd problem with OAEP
padding. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top