I write a Java service of 3DES encryption, however, if the encrypt string length is not 8, 16, 24 … bytes, it will throw “javax.crypto.IllegalBlockSizeException: Input data length not a multiple of blocksize.”, howevere, when i test it in another server, it works properly, did any of you have any idea on that?
Furthermore, what should be the length of the key? is it 24 bytes or 32 bytes? is it possible to use a 32 bytes key to encrypt?
The issue may be that the default security provider in the JVM that is used by your IS installation may be different from the security provider used by your other server.
Different providers may implement the 3DES algorithm differently which could account for the differences in the block sizes and padding approaches.
You can specify a particular provider as the second parameter of your Cipher.getInstance() call. If both IS and your other test server use the same provider you should get the same results.
The following IS java service will return a stringlist containing the names of the security providers that are installed in your current JVM. You can specify one of these names to use a specific security provider.
[highlight=java]
//Requires import statement for java.security.Provider and java.security.Security in the IS java service “shared” tab
Did you find out which java security providers were in use on each of your servers? Did you change providers or just pick an algorithm that was implemented the same in the providers you were already using?