mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-23 17:22:16 -05:00
fix RequiredInputParcel handling in CertifyOperation
This commit is contained in:
parent
213798dde1
commit
dd94c70fbe
@ -79,13 +79,32 @@ public class CertifyOperation extends BaseOperation {
|
|||||||
log.add(LogType.MSG_CRT_UNLOCK, 1);
|
log.add(LogType.MSG_CRT_UNLOCK, 1);
|
||||||
certificationKey = secretKeyRing.getSecretKey();
|
certificationKey = secretKeyRing.getSecretKey();
|
||||||
|
|
||||||
if (!cryptoInput.hasPassphrase()) {
|
Passphrase passphrase;
|
||||||
return new CertifyResult(log, RequiredInputParcel.createRequiredSignPassphrase(
|
|
||||||
certificationKey.getKeyId(), certificationKey.getKeyId(), null));
|
|
||||||
}
|
|
||||||
|
|
||||||
// certification is always with the master key id, so use that one
|
switch (certificationKey.getSecretKeyType()) {
|
||||||
Passphrase passphrase = cryptoInput.getPassphrase();
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
if (!certificationKey.unlock(passphrase)) {
|
if (!certificationKey.unlock(passphrase)) {
|
||||||
log.add(LogType.MSG_CRT_ERROR_UNLOCK, 2);
|
log.add(LogType.MSG_CRT_ERROR_UNLOCK, 2);
|
||||||
|
Loading…
Reference in New Issue
Block a user