byte[] (byte[] password, int size, byte[] data) { try { Cipher c = Cipher.getInstance(ENCRYPT_DATA_ALGORITHM); c.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(password, SECRET_KEY_ALGORITHM), CBC_SALT_DATA); c.update(new byte[]{(byte)(size >> 24), (byte)(size >> 16), (byte)(size >> 8), (byte)(size)}); return c.doFinal(data); } catch (Exception e) { throw new IllegalStateException(ENCRYPT_DATA_ALGORITHM + " is not available", e); } }