JolokiaCipher { public String decrypt(final String pEncryptedText) throws GeneralSecurityException { byte[] allEncryptedBytes = Base64Util.decode(pEncryptedText); int totalLen = allEncryptedBytes.length; byte[] salt = new byte[SALT_SIZE]; System.arraycopy(allEncryptedBytes, 0, salt, 0, SALT_SIZE); byte padLen = allEncryptedBytes[SALT_SIZE]; byte[] encryptedBytes = new byte[totalLen - SALT_SIZE - 1 - padLen]; System.arraycopy(allEncryptedBytes, SALT_SIZE + 1, encryptedBytes, 0, encryptedBytes.length); Cipher cipher = createCipher(salt, Cipher.DECRYPT_MODE); byte[] clearBytes = cipher.doFinal(encryptedBytes); return new String(clearBytes, Charset.forName("UTF-8")); } JolokiaCipher();  JolokiaCipher(KeyHolder pKeyHolder); String encrypt(final String pText); String decrypt(final String pEncryptedText); static final String JOLOKIA_CYPHER_PASSWORD; }
@Test public void testDecrypt() throws Exception { String clear = cipher.decrypt(encryptedText); assertEquals(clearText, clear); }