aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-09-30 02:03:17 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2014-09-30 02:03:17 +0200
commit11d0f4510b70a0c2b14c2f28b2ab153749dad821 (patch)
tree813065e5e4625c3d0b2c7b7fbc519b960489bdd8 /OpenKeychain/src/main
parentbd3f6a22cb6a5f2f637076e546ba0ec952213680 (diff)
downloadopen-keychain-11d0f4510b70a0c2b14c2f28b2ab153749dad821.tar.gz
open-keychain-11d0f4510b70a0c2b14c2f28b2ab153749dad821.tar.bz2
open-keychain-11d0f4510b70a0c2b14c2f28b2ab153749dad821.zip
pass key id for check from EncryptActivity to NfcActivity
Diffstat (limited to 'OpenKeychain/src/main')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java4
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/results/SignEncryptResult.java8
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java5
3 files changed, 13 insertions, 4 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java
index c7d6455ab..40e265253 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java
@@ -569,7 +569,9 @@ public class PgpSignEncrypt {
log.add(LogType.MSG_SE_PENDING_NFC, indent);
SignEncryptResult result =
new SignEncryptResult(SignEncryptResult.RESULT_PENDING_NFC, log);
- result.setNfcData(e.hashToSign, e.hashAlgo, e.creationTimestamp, mSignaturePassphrase);
+ // Note that the checked key here is the master key, not the signing key
+ // (although these are always the same on Yubikeys)
+ result.setNfcData(mSignatureMasterKeyId, e.hashToSign, e.hashAlgo, e.creationTimestamp, mSignaturePassphrase);
Log.d(Constants.TAG, "e.hashToSign"+ Hex.toHexString(e.hashToSign));
return result;
}
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/results/SignEncryptResult.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/results/SignEncryptResult.java
index 0f3c93385..cded70b7f 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/results/SignEncryptResult.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/results/SignEncryptResult.java
@@ -32,6 +32,7 @@ public class SignEncryptResult extends OperationResult {
long mKeyIdPassphraseNeeded;
+ long mNfcKeyId;
byte[] mNfcHash;
int mNfcAlgo;
Date mNfcTimestamp;
@@ -45,13 +46,18 @@ public class SignEncryptResult extends OperationResult {
mKeyIdPassphraseNeeded = keyIdPassphraseNeeded;
}
- public void setNfcData(byte[] nfcHash, int nfcAlgo, Date nfcTimestamp, String passphrase) {
+ public void setNfcData(long nfcKeyId, byte[] nfcHash, int nfcAlgo, Date nfcTimestamp, String passphrase) {
+ mNfcKeyId = nfcKeyId;
mNfcHash = nfcHash;
mNfcAlgo = nfcAlgo;
mNfcTimestamp = nfcTimestamp;
mNfcPassphrase = passphrase;
}
+ public long getNfcKeyId() {
+ return mNfcKeyId;
+ }
+
public byte[] getNfcHash() {
return mNfcHash;
}
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java
index 58bbcb4f5..5fc047911 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java
@@ -30,13 +30,14 @@ public abstract class EncryptActivity extends DrawerActivity {
startActivityForResult(intent, REQUEST_CODE_PASSPHRASE);
}
- protected void startNfcSign(String pin, byte[] hashToSign, int hashAlgo) {
+ protected void startNfcSign(long keyId, String pin, byte[] hashToSign, int hashAlgo) {
// build PendingIntent for Yubikey NFC operations
Intent intent = new Intent(this, NfcActivity.class);
intent.setAction(NfcActivity.ACTION_SIGN_HASH);
// pass params through to activity that it can be returned again later to repeat pgp operation
intent.putExtra(NfcActivity.EXTRA_DATA, new Intent()); // not used, only relevant to OpenPgpService
+ intent.putExtra(NfcActivity.EXTRA_KEY_ID, keyId);
intent.putExtra(NfcActivity.EXTRA_PIN, pin);
intent.putExtra(NfcActivity.EXTRA_NFC_HASH_TO_SIGN, hashToSign);
intent.putExtra(NfcActivity.EXTRA_NFC_HASH_ALGO, hashAlgo);
@@ -102,7 +103,7 @@ public abstract class EncryptActivity extends DrawerActivity {
SignEncryptResult.RESULT_PENDING_NFC) {
mNfcTimestamp = pgpResult.getNfcTimestamp();
- startNfcSign(pgpResult.getNfcPassphrase(), pgpResult.getNfcHash(), pgpResult.getNfcAlgo());
+ startNfcSign(pgpResult.getNfcKeyId(), pgpResult.getNfcPassphrase(), pgpResult.getNfcHash(), pgpResult.getNfcAlgo());
} else {
throw new RuntimeException("Unhandled pending result!");
}