mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
pass key id for check from EncryptActivity to NfcActivity
This commit is contained in:
parent
bd3f6a22cb
commit
11d0f4510b
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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!");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user