This post has NOT been accepted by the mailing list yet.
We're using JDK 8,with bouncycastle 1.5. We have two PC. Each PC can encrypt and decrypt corretly. But if one PC encrypt, and the other one decrypt it, there is an exception thrown:
javax.crypto.BadPaddingException: Invalid MAC.
at org.bouncycastle.jcajce.provider.asymmetric.ec.IESCipher.engineDoFinal(Unknown Source)
Here is my decryption code:
File secKey = new File(ROOT_PATH+"pkcs8_key.key");
byte privateKeyB = readByte(secKey);
PKCS8EncodedKeySpec privateSpec = new PKCS8EncodedKeySpec(privateKeyB);
FileUtils.writeByteArrayToFile(new File(ROOT_PATH+"test/real/testout_de.txt"), decrypted);`
I've searched a lot for invalid mac but no answers. Is it means ECC can only encrypt and decrypt on the same PC? Or is there anything wrong in it?