/** * Generate a new AES 256 bit encryption key. Once generated, this key can * be used to replace the default key. * * @param keysize must be a supported key size, using 128 or 256 * @return */ public static String GEN(final short keysize) { try { return AesCbcWithIntegrity.generateKey().toString(); } catch (GeneralSecurityException ex) { log.log(Level.ERROR, "There was an error generating key, this could indicate that you're making a 256 bit key on a system that does not have the Java Crypto Extensions installed. . Is JCE installed? " + (isJCEInstalled ? "yes " : "no ") + ex.getMessage()); log.log(Level.DEBUG, "error generating key, this could indicate that you're making a 256 bit key on a system that does not have the Java Crypto Extensions installed. " + ex.getMessage(), ex); } return null; }