public void encryptFile() {
        try {
            if (_path.isEmpty()) {
                Logger.addMessage("Select file to encrypt.");
                return;
            }

            this.setSecretKeyFromProvider(_keyProvider);

            if (!_properies.mode.equalsIgnoreCase("ECB")) {
                SecureRandom sr = new SecureRandom();
                sr.nextBytes(_iv);
                _properies.iv = HexOperations.toHexString(_iv);
                _cipher.init(Cipher.ENCRYPT_MODE, _key, new IvParameterSpec(_iv));
            } else {
                _properies.subBlockSize = null;
                _cipher.init(Cipher.ENCRYPT_MODE, _key);
            }

            _properies.key = HexOperations.toHexString(_keyProvider.getCiphredKey());
            _properies.keySize = Integer.toString(_key.getEncoded().length * 8);
            _XMLHeaderHandler.makeXMLHeaderFile(_cryptPath);

            this.encrypt(new FileInputStream(_path), new FileOutputStream(_cryptPath, true));
            _iv = _cipher.getIV();
            Logger.addMessage("File encrypted to: " + _cryptPath);
        } catch (InvalidKeyException | IOException | InvalidAlgorithmParameterException ex) {
            Logger.addMessage("Exception in encryptFile(): " + ex);
        } finally {
            burnKey();
        }
    }