public void decrypt(String file, String encrypted_file) throws Exception {
        RandomAccessFile PGP_file = new RandomAccessFile(encrypted_file, "r");
        int len = -1;
        byte[] arr = new byte[2];
        while ((len = PGP_file.read(arr)) != -1 && (arr[0] & 0xff) != PKESKP_TAG) {
            //System.out.println("decrypt: skip packet for PKESKP");
            PGP_file.seek(arr[1] & 0xff);
        }
        if (len > 0) {
            PGP_file.seek(PGP_file.getFilePointer() - 2);
            FileOutputStream output_file = new FileOutputStream(file);
            PKESKP key_packet = new PKESKP(PGP_file);
            byte[] formatted_decr_key =
                    RSA.RSAoperation(Utilities.getHexString(key_packet.encr_key.MPI_string), priv_exp, mod);
            formatted_decr_key = PKCS1.decrypt(formatted_decr_key);
            byte[] real_key = new byte[formatted_decr_key.length - 3];
            System.arraycopy(formatted_decr_key, 1, real_key, 0, real_key.length);
            //BigInteger test = new BigInteger(real_key);
            //String hexKey = test.toString(16);
            //int hc = hexKey.hashCode();
            if (formatted_decr_key[0] == TRIPLEDES_ID) {
                SecretKeySpec ks = new SecretKeySpec(real_key, "DESede");
                Des decryptor = new Des(ks);
                decryptor.decrypt(PGP_file, output_file);
            } else
                System.out.println("Decrypt RSA PKESKP: id of symmetric encryption algorithm used to encrypt " +
                        "data isn't TripleDES");
            output_file.close();
        } else
            System.out.println("Decrypt: can't find PKESKP packet");
        PGP_file.close();
    }