Problems in C# and Java SSL Asymmetric encryption
843811Dec 31 2009 — edited Jan 4 2010Hi,
I have a C# SSL server(SSPI) and Java JSSE based client. Both of them are able to complete their handshaking successfully. I am encrypting data in java using following code,
Cipher cipher = Cipher.getInstance("RSA/NONE/PKCS1PADDING");
cipher.init(Cipher.ENCRYPT_MODE, servercert.getPublicKey());
cipher.doFinal(inpBytes);
In C# using this code I am trying to decrypt,
RSACryptoServiceProvider rsa = pfxcert2.PrivateKey as RSACryptoServiceProvider;
byte[] decryptedBytes = rsa.Decrypt(inpBytes, true);
I am getting this error while decryption "The data to be decrypted exceeds the maximum for this modulus of 128 bytes."
I know this is java forum, but I want to make this to work between Java and C# only. I have no other choice.
If anyone has suggestion about this issue, please reply.
I searched a lot on internet about this issue, but haven't found any solution.
Thanks in advance