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

@@ -32,7 +32,7 @@ import android.widget.Toast;
public class AskForSecretKeyPassPhrase {
public static interface PassPhraseCallbackInterface {
void passPhraseCallback(String passPhrase);
void passPhraseCallback(long keyId, String passPhrase);
}
public static Dialog createDialog(Activity context, long secretKeyId,
@@ -43,7 +43,7 @@ public class AskForSecretKeyPassPhrase {
final PGPSecretKey secretKey;
if (secretKeyId == 0) {
if (secretKeyId == Id.key.symmetric || secretKeyId == Id.key.none) {
secretKey = null;
alert.setMessage(context.getString(R.string.passPhraseForSymmetricEncryption));
} else {
@@ -71,6 +71,7 @@ public class AskForSecretKeyPassPhrase {
public void onClick(DialogInterface dialog, int id) {
activity.removeDialog(Id.dialog.pass_phrase);
String passPhrase = "" + input.getText();
long keyId;
if (secretKey != null) {
try {
secretKey.extractPrivateKey(passPhrase.toCharArray(),
@@ -81,8 +82,11 @@ public class AskForSecretKeyPassPhrase {
Toast.LENGTH_SHORT).show();
return;
}
keyId = secretKey.getKeyID();
} else {
keyId = Id.key.symmetric;
}
cb.passPhraseCallback(passPhrase);
cb.passPhraseCallback(keyId, passPhrase);
}
});