01-26-2012 10:51 PM
The exception was thrown when trying to decrypt the password while running the application inside NetWeaver AS.
The code example is:
Cipher decCipher = Cipher.getInstance("AES/CFB8/PKCS5Padding");
SecretKeySpec key = c();
AlgorithmParameterSpec paramSpec = d();
decCipher.init(2, key, paramSpec);
byte original[] = decCipher.doFinal(decode("2721838ACDF9805FD60063154D4EEF3B"));
And the exception stack trace is:
javax.crypto.BadPaddingException: Invalid PKCS#5 padding length: 7
at iaik.security.cipher.v.b(Unknown Source)
at iaik.security.cipher.z.b(Unknown Source)
at iaik.security.cipher.z.engineDoFinal(Unknown Source)
at javax.crypto.Cipher.doFinal(DashoA13*..)
Note that the same code would be able to decrypt the password correctly when running in NWDS (Eclipse) using sapjvm 5.
Thanks
01-27-2012 9:48 PM
OK, I made a little bit progress on this --- it turns out the SAP NetWeaver is using IAIK by default as the security provider, which is incompitable with the Cipher which has been used to encrypt the password.
Now the question is how to remove, or not using IAIK package, in NetWeaver?