diff options
author | hsm <hsm@lamia.panaceas.james.local> | 2016-05-29 03:12:09 +0100 |
---|---|---|
committer | hsm <hsm@lamia.panaceas.james.local> | 2016-05-29 04:47:15 +0100 |
commit | 5aa36b089f09346787e44f9850924faae1fda363 (patch) | |
tree | 0f14297dedecb42af771743241a0ed7ee78f308c /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SecurityTokenOperationActivity.java | |
parent | 24b92172be818c7ee67a235ad8403f01a4495987 (diff) | |
download | open-keychain-master.tar.gz open-keychain-master.tar.bz2 open-keychain-master.zip |
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SecurityTokenOperationActivity.java')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SecurityTokenOperationActivity.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SecurityTokenOperationActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SecurityTokenOperationActivity.java index 4d07025e6..4e7c06b69 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SecurityTokenOperationActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SecurityTokenOperationActivity.java @@ -200,10 +200,16 @@ public class SecurityTokenOperationActivity extends BaseSecurityTokenActivity { break; } case SECURITY_TOKEN_SIGN: { - long tokenKeyId = KeyFormattingUtils.getKeyIdFromFingerprint( + long tokenSignKeyId = KeyFormattingUtils.getKeyIdFromFingerprint( mSecurityTokenHelper.getKeyFingerprint(KeyType.SIGN)); - if (tokenKeyId != mRequiredInput.getSubKeyId()) { + long tokenAuthKeyId = KeyFormattingUtils.getKeyIdFromFingerprint( + mSecurityTokenHelper.getKeyFingerprint(KeyType.AUTH)); + + long requiredKey = mRequiredInput.getSubKeyId(); + + + if ((tokenSignKeyId != requiredKey) && (tokenAuthKeyId != requiredKey)) { throw new IOException(getString(R.string.error_wrong_security_token)); } @@ -212,7 +218,7 @@ public class SecurityTokenOperationActivity extends BaseSecurityTokenActivity { for (int i = 0; i < mRequiredInput.mInputData.length; i++) { byte[] hash = mRequiredInput.mInputData[i]; int algo = mRequiredInput.mSignAlgos[i]; - byte[] signedHash = mSecurityTokenHelper.calculateSignature(hash, algo); + byte[] signedHash = mSecurityTokenHelper.calculateSignature(hash, algo, requiredKey == tokenAuthKeyId); mInputParcel.addCryptoData(hash, signedHash); } break; |