@Test(expectedExceptions = GearmanException.class, expectedExceptionsMessageRegExp = "Cryptography Algorithm '" + Aes.CRYPT_ALGORITHM + "' not supported from installed JRE.*") public void testJCEmessage() throws Exception { Aes.catchCipherError("encrypting", new InvalidKeyException("Illegal key size or default parameters")); }
static void catchCipherError(String mode, Exception e) { if (e instanceof InvalidKeyException) { LOGGER.error("JRE can't initialize Cipher " + CRYPT_ALGORITHM, e); throw new GearmanException(String.format( "Cryptography Algorithm '%s' not supported from installed JRE '%s, %s, %s: %s'. Please ensure that the Java Cryptography Extension (JCE) is installed, see Sakuli documentation: http: CRYPT_ALGORITHM, System.getProperty("java.vm.name", ""), System.getProperty("java.vendor", ""), System.getProperty("java.version", ""), System.getProperty("java.home", ""))); } LOGGER.error("Error while " + mode + ": ", e); throw new GearmanException("Error while " + mode + ": " + e.getMessage()); }
Aes { static void catchCipherError(String mode, Exception e) { if (e instanceof InvalidKeyException) { LOGGER.error("JRE can't initialize Cipher " + CRYPT_ALGORITHM, e); throw new GearmanException(String.format( "Cryptography Algorithm '%s' not supported from installed JRE '%s, %s, %s: %s'. Please ensure that the Java Cryptography Extension (JCE) is installed, see Sakuli documentation: http: CRYPT_ALGORITHM, System.getProperty("java.vm.name", ""), System.getProperty("java.vendor", ""), System.getProperty("java.version", ""), System.getProperty("java.home", ""))); } LOGGER.error("Error while " + mode + ": ", e); throw new GearmanException("Error while " + mode + ": " + e.getMessage()); } }
Aes { static void catchCipherError(String mode, Exception e) { if (e instanceof InvalidKeyException) { LOGGER.error("JRE can't initialize Cipher " + CRYPT_ALGORITHM, e); throw new GearmanException(String.format( "Cryptography Algorithm '%s' not supported from installed JRE '%s, %s, %s: %s'. Please ensure that the Java Cryptography Extension (JCE) is installed, see Sakuli documentation: http: CRYPT_ALGORITHM, System.getProperty("java.vm.name", ""), System.getProperty("java.vendor", ""), System.getProperty("java.version", ""), System.getProperty("java.home", ""))); } LOGGER.error("Error while " + mode + ": ", e); throw new GearmanException("Error while " + mode + ": " + e.getMessage()); }  }
Aes { static void catchCipherError(String mode, Exception e) { if (e instanceof InvalidKeyException) { LOGGER.error("JRE can't initialize Cipher " + CRYPT_ALGORITHM, e); throw new GearmanException(String.format( "Cryptography Algorithm '%s' not supported from installed JRE '%s, %s, %s: %s'. Please ensure that the Java Cryptography Extension (JCE) is installed, see Sakuli documentation: http: CRYPT_ALGORITHM, System.getProperty("java.vm.name", ""), System.getProperty("java.vendor", ""), System.getProperty("java.version", ""), System.getProperty("java.home", ""))); } LOGGER.error("Error while " + mode + ": ", e); throw new GearmanException("Error while " + mode + ": " + e.getMessage()); }  static byte[] encrypt(String text, String password); static String decrypt(byte[] enrcypted, String password); }
Aes { static void catchCipherError(String mode, Exception e) { if (e instanceof InvalidKeyException) { LOGGER.error("JRE can't initialize Cipher " + CRYPT_ALGORITHM, e); throw new GearmanException(String.format( "Cryptography Algorithm '%s' not supported from installed JRE '%s, %s, %s: %s'. Please ensure that the Java Cryptography Extension (JCE) is installed, see Sakuli documentation: http: CRYPT_ALGORITHM, System.getProperty("java.vm.name", ""), System.getProperty("java.vendor", ""), System.getProperty("java.version", ""), System.getProperty("java.home", ""))); } LOGGER.error("Error while " + mode + ": ", e); throw new GearmanException("Error while " + mode + ": " + e.getMessage()); }  static byte[] encrypt(String text, String password); static String decrypt(byte[] enrcypted, String password); static final int DEFAULT_KEY_LENGTH; static final String CRYPT_ALGORITHM; static int keyLength; }