password cache introduced, not cleared yet.

This commit is contained in:
Thialfihar
2010-05-15 15:19:56 +00:00
parent cab78bf4c1
commit 363dcb62b8
10 changed files with 129 additions and 49 deletions

View File

@@ -235,8 +235,7 @@ public class EncryptActivity extends BaseActivity {
if (checkBox.isChecked()) {
selectSecretKey();
} else {
setSecretKeyId(0);
Apg.setPassPhrase(null);
setSecretKeyId(Id.key.none);
updateView();
}
}
@@ -447,7 +446,7 @@ public class EncryptActivity extends BaseActivity {
return;
}
if (getSecretKeyId() != 0 && Apg.getPassPhrase() == null) {
if (getSecretKeyId() != 0 && Apg.getCachedPassPhrase(getSecretKeyId()) == null) {
showDialog(Id.dialog.pass_phrase);
return;
}
@@ -465,8 +464,8 @@ public class EncryptActivity extends BaseActivity {
}
@Override
public void passPhraseCallback(String passPhrase) {
super.passPhraseCallback(passPhrase);
public void passPhraseCallback(long keyId, String passPhrase) {
super.passPhraseCallback(keyId, passPhrase);
if (mEncryptTarget == Id.target.file) {
askForOutputFilename();
} else {
@@ -544,11 +543,12 @@ public class EncryptActivity extends BaseActivity {
if (signOnly) {
Apg.signText(this, in, out, getSecretKeyId(),
Apg.getPassPhrase(), getDefaultHashAlgorithm(), this);
Apg.getCachedPassPhrase(getSecretKeyId()),
getDefaultHashAlgorithm(), this);
} else {
Apg.encrypt(this, in, out, size, useAsciiArmour,
encryptionKeyIds, signatureKeyId,
Apg.getPassPhrase(), this,
Apg.getCachedPassPhrase(signatureKeyId), this,
getDefaultEncryptionAlgorithm(), getDefaultHashAlgorithm(),
passPhrase);
}