public void decryptFile(File read, File write) {
        InputStream filein = null;
        InputStream in = null;
        OutputStream fileOut = null;
        try {
            cipher.init(Cipher.DECRYPT_MODE, getSecretKeySpec(encryptKey));
            filein = new FileInputStream(read);
            fileOut = new FileOutputStream(write);
            in = new CipherInputStream(filein, cipher);
            int redbytes = 0;
            byte[] buffer = new byte[1024];
            while ((redbytes = in.read(buffer)) != -1) {
               // System.out.println("bytes read after decryption :" + redbytes);
                fileOut.write(buffer, 0, redbytes);
            }
            fileOut.flush();
            // read.delete();
            write.renameTo(read);
        } catch (FileNotFoundException ex) {
            ex.printStackTrace();
        } catch (IOException ex) {
            ex.printStackTrace();
        } catch (InvalidKeyException ik) {
            ik.printStackTrace();
        } finally {
            try {
                in.close();
                filein.close();
                fileOut.close();
               
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }


        /*try{
        cipher.init(Cipher.DECRYPT_MODE, getSecretKeySpec(encryptKey));
        byte[] dec = new sun.misc.BASE64Decoder().decodeBuffer("");
        byte[] utf8 = cipher.doFinal(dec);
        new String(utf8, "UTF8");
        }catch(InvalidKeyException ik){
        ik.printStackTrace();
        }catch(IllegalBlockSizeException ib){
        ib.printStackTrace();
        }catch(BadPaddingException bp){
        bp.printStackTrace();
        }catch(IOException io){
        io.printStackTrace();
        }*/
    }