|
security
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
RSA Encrypt/Decrypt with OAEP.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 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 Show quoteHide quote "Sushant Bhatia" <sushant.bha***@gmail.com> wrote in message news:1115300715.397549.28100@g14g2000cwa.googlegroups.com... > 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 > 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.
Form Authentication and new browser instance
System.ExecutionEngineException for certificate object creation Role based security on local machine sspi in c# Web Services and Access Control I keep receiving a file/path access error. NCrypto Encryption & Decryption CAS and performance RE: Web service consuming error Sorry for repeating previous subjects... |
|||||||||||||||||||||||