0
votes

I am facing one strange issue. My server is giving me public key to encrypt the user name and password.

It is giving different result if we use rsa/ecb/pkcs1padding (Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding")) algorithm. Same algorithm is using in Java server and android, but it gives different results.

If we use RSA/ECB/NOPADDING algorithm, both results are same and working fine. But i need to implement rsa/ecb/pkcs1padding in android.

Please help to identify the issue ?

Thanks.

2
Why did you choose that "PKCS1Padding" transformation algorithm? I am facing the same issue. Did you ever solve it?B W

2 Answers

0
votes

it's because of padding function, when you use PKCS#1 padding and other ways,it will generate a random number and make your cipher text different each time.

-1
votes

I didn't know much about RSA algorithm.

I found it will have always different encryption result with same key in RSA with padding.