public void saveFileWithCipher(File file, boolean useCipher,
			boolean resetOldPass) {
		try {
			JAXBContext jc = JAXBContext
					.newInstance("org.nisshiee.passwordManager.xml");
			Marshaller marshaller = jc.createMarshaller();
			marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
					Boolean.TRUE);

			FileOutputStream fos = new FileOutputStream(file);
			JAXBElement<Db> je = new ObjectFactory().createDb(db);
			StringWriter sw = new StringWriter();
			marshaller.marshal(je, sw);
			OutputStreamWriter osw = new OutputStreamWriter(fos, "utf-8");
			BufferedWriter bw = new BufferedWriter(osw);
			String data = new String(sw.getBuffer());
			if (Setting.USE_CIPHER) {
				if (useCipher) {
					if (resetOldPass) {
						this.password = null;
					}
					String message = "ファイルを復号するためのパスワードを入力してください.";
					if (this.password == null) {
						this.password = JOptionPane.showInputDialog(
								this.mainFrame, message);
					}
					if (this.password == null) {
						return;
					} else if (this.password.length() < 5
							|| this.password.length() > 128) {
						message = "ファイル出力は行われませんでした.\n";
						message += "パスワードは5文字以上128文字以下(半角)で設定してください.";
						JOptionPane.showMessageDialog(this.mainFrame, message,
								"不正なパスワード", JOptionPane.WARNING_MESSAGE);
						this.password = null;
						return;
					}
					data = new String(PMCipher.encrypt(data, this.password,
							Setting.CIPHER_SCHEME));
				}
			}
			bw.write(data);
			bw.close();
			osw.close();
			fos.close();
			this.fileName = file.getName();
			if (Setting.USE_CIPHER) {
				this.mainFrame.getOverwriteItem().setEnabled(true);
				this.mainFrame.getOverwriteWithNewPassItem().setEnabled(true);
			}
			this.edited = false;
		} catch (Exception e) {
			e.printStackTrace();
		}
	}