public static void decryptDataFile(DataInputStream is, SecretKey secretKey, String outFile)
    {
        try {
            Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
//            Cipher cipher = Cipher.getInstance("AES");

            // Initialisierung

            byte[] v = new byte[16];
            File ivFile = new File("iv");
            DataInputStream foo = new DataInputStream(new FileInputStream(ivFile));
            foo.readFully(v);
            foo.close();

            cipher.init(Cipher.DECRYPT_MODE, secretKey, new IvParameterSpec(v));
//            cipher.init(Cipher.DECRYPT_MODE, secretKey);

            // Der Initialisierungsvektor IV muss dem EMPFAENGER spaeter als
            // Parameter mit uebergeben werden (falls nicht Betrieb im
            // ECB-Modus), daher muessen die erzeugten Parameter aus dem
            // Cipher-Objekt ausgelesen werden.
            if(cipher.getParameters() != null){
                System.out.println("Cipher Parameter: "
                        + cipher.getParameters().toString());
                AlgorithmParameters ap = cipher.getParameters();
            }

            File out = new File(outFile);
            DataOutputStream os = new DataOutputStream(new FileOutputStream(out));


            byte[] plain = new byte[16];
            int bytesRead;

            while (( bytesRead =is.read(plain)) == 16)
            {
                os.write(cipher.update(plain));
                plain = new byte[16];
            }
            if(bytesRead > 0)
            {
                byte[] rest = new byte[bytesRead];
                System.arraycopy(plain, 0, rest, 0, bytesRead);
                os.write(cipher.doFinal(rest));
            }else{
                os.write(cipher.doFinal());
            }

            os.close();
        }catch (Exception e)
        {
            e.printStackTrace();
        }

    }