PHP AES encrypt / decrypt

Please use an existing secure PHP encryption library It’s generally a bad idea to write your own cryptography unless you have experience breaking other peoples’ cryptography implementations. None of the examples here authenticate the ciphertext, which leaves them vulnerable to bit-rewriting attacks. If you can install PECL extensions, libsodium is even better <?php // PECL … Read more

Java default Crypto/AES behavior

For Oracle JDK 7 (tested), the default cipher for AES is AES/ECB/PKCS5Padding. The Java Security documentation doesn’t mention about this though (http://docs.oracle.com/javase/6/docs/technotes/guides/security/StandardNames.html#algspec), have to do some JUnit testing to find out.

InvalidKeyException Illegal key size

This error means that your Java virtual machine uses a policy that only allows restricted cryptography key sizes due to US export laws. Java 9 and higher The Unlimited Strength Jurisdiction Policy Files are included with Java 9 and used by default (see Security Updates in the Java 9 Migration Guide). If you get this … Read more

How to avoid installing “Unlimited Strength” JCE policy files when deploying an application?

There are a couple of commonly quoted solutions to this problem. Unfortunately neither of these are entirely satisfactory: Install the unlimited strength policy files. While this is probably the right solution for your development workstation, it quickly becomes a major hassle (if not a roadblock) to have non-technical users install the files on every computer. … Read more