views:

545

answers:

3

My friend has encrypted data with PKCS1 padding on an iPhone.

How can I decrypt that data in Java?

Java requires me to specify "algorithm/ciphermode/padding". The padding and the algorithm are known, but neither of us knows the cipher mode; it is not specified when encrypting on the iPhone.

+1  A: 

using bouncy castle and this code should be simple

dfa
One more issue here my friend is using iphone there is no bouncy castle in iphone .So I am facing the same problem.
Deepak
A: 

So whether the program will work?? One more thing how to get modulus from the public key generated by bouncy castle – sunil

imMobile
Are you signing in under two accounts? Regardless, how are you generating the public key? Are you using the RSAKeyPairGenerator class?
Adam Paynter
A: 

RSA doesn't really use a "mode"; modes are for block ciphers.

The built-in Sun provider will accept "RSA/ECB/PCKS1Padding" as a Cipher name. ECB is "Electronic Code Book", which doesn't mix any information from "block" to block; it is sort of "no cipher mode."

Other providers accept "None" as a cipher mode with RSA.

BouncyCastle is a good provider. I'm not sure why you would need to take the trouble to install it in this case, however. The SunJCE provider will work fine.

erickson