Hi!

I want to transfer RSA encrypted Data from a linux application to a .net 
webservice. I'm encrypting data with the method
RSA_public_encrypt with RSA_PCKS1_OAEP_PADDING.

On the .net side i get the error:

----------------
System.Security.Cryptography.CryptographicException: Padding is invalid and 
cannot be removed.
   at System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] 
inputBuffer, Int32 inputOffset, Int32 inputCount,
Byte[]& outputBuffer, Int32 outputOffset, PaddingMode paddingMode, Boolean 
fLast)
   at 
System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[]
 inputBuffer, Int32 inputOffset, Int32
inputCount)
   at System.Security.Cryptography.CryptoStream.Read(Byte[] buffer, Int32 
offset, Int32 count)
----------------

If i change the padding parameter to RSA_PKCS1_PADDING it get the different 
error:

----------------
System.Security.Cryptography.CryptographicException: Error occurred while 
decoding OAEP padding.
   at System.Security.Cryptography.Utils._DecryptPKWin2KEnh(SafeKeyHandle 
hPubKey, Byte[] key, Boolean fOAEP, Int32& hr)
   at System.Security.Cryptography.RSACryptoServiceProvider.Decrypt(Byte[] rgb, 
Boolean fOAEP)
----------------

So OAEP padding seem to be more correct.

Does anybody know if i have to padd the buffer by using 
RSA_padding_add_PKCS1_OAEP() before giving the buffer to the encryption
function or what can be wrong here?

Any help is welcome...
Bernd




Attachment: PGP.sig
Description: PGP signature

Reply via email to