aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2014-07-21 15:10:29 +0200
committerDominik Schürmann <dominik@dominikschuermann.de>2014-07-21 15:10:29 +0200
commitd882572f0d92f1cc5306dca7bbac689eed344553 (patch)
tree7ba633a786bcff37d1a4719b9cae3b127c0009b9 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
parenta10f582513bf9b2a75fb3049d91fde4cf92c1d04 (diff)
downloadopen-keychain-d882572f0d92f1cc5306dca7bbac689eed344553.tar.gz
open-keychain-d882572f0d92f1cc5306dca7bbac689eed344553.tar.bz2
open-keychain-d882572f0d92f1cc5306dca7bbac689eed344553.zip
NFC Yubikey: only pass through hash of message and not whole content
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
index f7ee0eab3..a00759180 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
@@ -136,10 +136,10 @@ public class OpenPgpService extends RemoteService {
return result;
}
- private Intent getNfcIntent(Intent data, String in) {
+ private Intent getNfcIntent(Intent data, byte[] in) {
// build PendingIntent for Yubikey NFC operations
Intent intent = new Intent(getBaseContext(), NfcActivity.class);
- intent.setAction(NfcActivity.ACTION_SIGN);
+ intent.setAction(NfcActivity.ACTION_SIGN_HASH);
intent.putExtra(NfcActivity.EXTRA_NFC_DATA, in);
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
// pass params through to activity that it can be returned again later to repeat pgp operation
@@ -191,7 +191,7 @@ public class OpenPgpService extends RemoteService {
return passphraseBundle;
}
- String nfcData = data.getStringExtra(OpenPgpApi.EXTRA_NFC_DATA);
+ byte[] nfcData = data.getByteArrayExtra(OpenPgpApi.EXTRA_NFC_DATA);
// Get Input- and OutputStream from ParcelFileDescriptor
InputStream is = new ParcelFileDescriptor.AutoCloseInputStream(input);
@@ -223,6 +223,8 @@ public class OpenPgpService extends RemoteService {
throw new Exception(getString(R.string.error_could_not_extract_private_key));
} catch (PgpSignEncrypt.NoPassphraseException e) {
throw new Exception(getString(R.string.error_no_signature_passphrase));
+ } catch (PgpSignEncrypt.WrongPassphraseException e) {
+ throw new Exception(getString(R.string.error_wrong_passphrase));
} catch (PgpSignEncrypt.NoSigningKeyException e) {
throw new Exception(getString(R.string.error_no_signature_key));
} catch (PgpSignEncrypt.NeedNfcDataException e) {
@@ -333,6 +335,8 @@ public class OpenPgpService extends RemoteService {
throw new Exception(getString(R.string.error_could_not_extract_private_key));
} catch (PgpSignEncrypt.NoPassphraseException e) {
throw new Exception(getString(R.string.error_no_signature_passphrase));
+ } catch (PgpSignEncrypt.WrongPassphraseException e) {
+ throw new Exception(getString(R.string.error_wrong_passphrase));
} catch (PgpSignEncrypt.NoSigningKeyException e) {
throw new Exception(getString(R.string.error_no_signature_key));
}