private byte[] encrypt(byte[] data) throws Exception {
    if (config.getGroupPassword() == null) {
      return data;
    }
    Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
    byte[] iv = cipher.getParameters().getParameterSpec(IvParameterSpec.class).getIV();
    IvParameterSpec ivSpec = new IvParameterSpec(iv);
    SecretKeySpec keySpec = new SecretKeySpec(paddedPassword(config.getGroupPassword()), "AES");
    cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec);

    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    DataOutput output = new DataOutputStream(stream);
    output.writeInt(iv.length);
    output.write(iv);
    byte[] cypher = cipher.doFinal(data);
    output.writeInt(cypher.length);
    output.write(cypher);

    return stream.toByteArray();
  }
private byte[] encrypt(byte[] data) throws Exception {
    if (config.getGroupPassword() == null) {
      return data;
    }
    Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
    byte[] iv = cipher.getParameters().getParameterSpec(IvParameterSpec.class).getIV();
    IvParameterSpec ivSpec = new IvParameterSpec(iv);
    SecretKeySpec keySpec = new SecretKeySpec(paddedPassword(config.getGroupPassword()), "AES");
    cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec);

    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    DataOutput output = new DataOutputStream(stream);
    output.writeInt(iv.length);
    output.write(iv);
    byte[] cypher = cipher.doFinal(data);
    output.writeInt(cypher.length);
    output.write(cypher);

    return stream.toByteArray();
  }
private byte [ ] encrypt ( byte [ ] data ) throws Exception { if ( config . getGroupPassword ( ) == null ) { return data ; } Cipher cipher = Cipher . getInstance ( "AES/CBC/PKCS5Padding" ) ; byte [ ] iv = cipher . getParameters ( ) . getParameterSpec ( IvParameterSpec . class ) . getIV ( ) ; IvParameterSpec ivSpec = new IvParameterSpec ( iv ) ; SecretKeySpec keySpec = new SecretKeySpec ( paddedPassword ( config . getGroupPassword ( ) ) , "AES" ) ; cipher . init ( Cipher . ENCRYPT_MODE , keySpec , ivSpec ) ; ByteArrayOutputStream stream = new ByteArrayOutputStream ( ) ; DataOutput output = new DataOutputStream ( stream ) ; output . writeInt ( iv . length ) ; output . write ( iv ) ; byte [ ] cypher = cipher . doFinal ( data ) ; output . writeInt ( cypher . length ) ; output . write ( cypher ) ; return stream . toByteArray ( ) ; }
/* =============== ENCRYPTION =================
/ * =============== ENCRYPTION =================