Work on Yubikey decryption
This commit is contained in:
@@ -33,12 +33,15 @@ import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.openintents.openpgp.util.OpenPgpApi;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.helper.FileHelper;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpDecryptVerify;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpDecryptVerifyResult;
|
||||
import org.sufficientlysecure.keychain.service.KeychainIntentService;
|
||||
import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
|
||||
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
|
||||
import org.sufficientlysecure.keychain.ui.dialog.DeleteFileDialogFragment;
|
||||
import org.sufficientlysecure.keychain.ui.dialog.PassphraseDialogFragment;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
@@ -182,7 +185,20 @@ public class DecryptFileFragment extends DecryptFragment {
|
||||
returnData.getParcelable(KeychainIntentService.RESULT_DECRYPT_VERIFY_RESULT);
|
||||
|
||||
if (PgpDecryptVerifyResult.KEY_PASSHRASE_NEEDED == decryptVerifyResult.getStatus()) {
|
||||
showPassphraseDialogForFilename(decryptVerifyResult.getKeyIdPassphraseNeeded());
|
||||
try {
|
||||
// try to get passphrase from cache...
|
||||
String passphrase = PassphraseCacheService.getCachedPassphrase(
|
||||
getActivity(), decryptVerifyResult.getKeyIdPassphraseNeeded());
|
||||
|
||||
if (passphrase != null) {
|
||||
// try again with passphrase from cache
|
||||
decryptOriginalFilename(passphrase);
|
||||
} else {
|
||||
showPassphraseDialogForFilename(decryptVerifyResult.getKeyIdPassphraseNeeded());
|
||||
}
|
||||
} catch (PassphraseCacheService.KeyNotFoundException e) {
|
||||
Log.e(Constants.TAG, "PassphraseCacheService.KeyNotFoundException", e);
|
||||
}
|
||||
} else if (PgpDecryptVerifyResult.SYMMETRIC_PASSHRASE_NEEDED ==
|
||||
decryptVerifyResult.getStatus()) {
|
||||
showPassphraseDialogForFilename(Constants.key.symmetric);
|
||||
|
||||
@@ -186,6 +186,7 @@ public class EditKeyFragment extends LoaderFragment implements
|
||||
mSaveKeyringParcel.mMasterKeyId);
|
||||
} catch (PassphraseCacheService.KeyNotFoundException e) {
|
||||
Log.e(Constants.TAG, "Key not found!", e);
|
||||
Toast.makeText(getActivity(), R.string.error_no_secret_key_found, Toast.LENGTH_SHORT).show();
|
||||
getActivity().finish();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user