// selectedText = text;
}
// Decrypt clicked text
public void decryptText(String id, String text, String hint) {
EnCrypt crypt = new EnCrypt();
String plainText = null;
Calendar currentTime = new GregorianCalendar();
Long l = new Long(currentTime.getTimeInMillis());
String slot = new String(Long.toString(l));
// First, try to decrypt with any keys we already have
for (int i=0; i<Global.passwordRemember.size(); i++) {
plainText = crypt.decrypt(text, Global.passwordRemember.get(i).getFirst(), 64);
if (plainText != null) {
slot = new String(Long.toString(l));
Global.passwordSafe.put(slot, Global.passwordRemember.get(i));
removeEncryption(id, plainText, false, slot);
return;
}
}
EnDecryptDialog dialog = new EnDecryptDialog();
dialog.setHint(hint);
while (plainText == null || !dialog.okPressed()) {
dialog.exec();
if (!dialog.okPressed()) {
return;
}
plainText = crypt.decrypt(text, dialog.getPassword().trim(), 64);
if (plainText == null) {
QMessageBox.warning(this, tr("Incorrect Password"), tr("The password entered is not correct"));
}
}
Pair<String,String> passwordPair = new Pair<String,String>();