I am creating an encrypted license file with Java on a Linux machine. On the same linux machine I can use another program which has the same pass phrase to decrpyt this file. It works well.
If I copy that file onto a windows machine and run the same program, I get a BadPaddingException :
If I create the file on the windows machine, then I can decrypt it on the Windows machine. So it works well enough. Does anybody know whats going on here ? I am moving this app into production soon and I would like a better understanding of whats going on so I can deal with problems that might crop up.
I would bet your problem is that you are using the no-args String.getBytes() method. This is almost always incorrect but it uses the platform's default charset. This default may be different on different platforms. By using the default charset you are risking nonportable behavior.
Always specify an explicit charset. In almost all cases you should always specify the "UTF-8" charset.