aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2015-05-29 20:26:06 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2015-05-29 20:26:06 +0200
commitdd94c70fbe92e8b2f578b93da428dc9c7d728d84 (patch)
tree9dcfbbb85744b3f6583d12dce74dc10548e31b99
parent213798dde1d6581610aefa6f1e60df1551d9bcba (diff)
downloadopen-keychain-dd94c70fbe92e8b2f578b93da428dc9c7d728d84.tar.gz
open-keychain-dd94c70fbe92e8b2f578b93da428dc9c7d728d84.tar.bz2
open-keychain-dd94c70fbe92e8b2f578b93da428dc9c7d728d84.zip
fix RequiredInputParcel handling in CertifyOperation
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/CertifyOperation.java31
1 files changed, 25 insertions, 6 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/CertifyOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/CertifyOperation.java
index 051517abd..186d0531d 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/CertifyOperation.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/CertifyOperation.java
@@ -79,14 +79,33 @@ public class CertifyOperation extends BaseOperation {
log.add(LogType.MSG_CRT_UNLOCK, 1);
certificationKey = secretKeyRing.getSecretKey();
- if (!cryptoInput.hasPassphrase()) {
- return new CertifyResult(log, RequiredInputParcel.createRequiredSignPassphrase(
- certificationKey.getKeyId(), certificationKey.getKeyId(), null));
+ Passphrase passphrase;
+
+ switch (certificationKey.getSecretKeyType()) {
+ case PIN:
+ case PATTERN:
+ case PASSPHRASE:
+ if (!cryptoInput.hasPassphrase()) {
+ return new CertifyResult(log, RequiredInputParcel.createRequiredSignPassphrase(
+ certificationKey.getKeyId(), certificationKey.getKeyId(), null));
+ }
+ // certification is always with the master key id, so use that one
+ passphrase = cryptoInput.getPassphrase();
+ break;
+
+ case PASSPHRASE_EMPTY:
+ passphrase = new Passphrase("");
+ break;
+
+ case DIVERT_TO_CARD:
+ passphrase = null;
+ break;
+
+ default:
+ log.add(LogType.MSG_CRT_ERROR_UNLOCK, 2);
+ return new CertifyResult(CertifyResult.RESULT_ERROR, log);
}
- // certification is always with the master key id, so use that one
- Passphrase passphrase = cryptoInput.getPassphrase();
-
if (!certificationKey.unlock(passphrase)) {
log.add(LogType.MSG_CRT_ERROR_UNLOCK, 2);
return new CertifyResult(CertifyResult.RESULT_ERROR, log);