decrypt: skip unavailable and unsuitable keys
This commit is contained in:
@@ -635,6 +635,8 @@ public abstract class OperationResult implements Parcelable {
|
||||
MSG_EK_ERROR_NOT_FOUND (LogLevel.ERROR, R.string.msg_ek_error_not_found),
|
||||
|
||||
// decryptverify
|
||||
MSG_DC_ASKIP_BAD_FLAGS (LogLevel.DEBUG, R.string.msg_dc_askip_bad_flags),
|
||||
MSG_DC_ASKIP_UNAVAILABLE (LogLevel.DEBUG, R.string.msg_dc_askip_unavailable),
|
||||
MSG_DC_ASKIP_NO_KEY (LogLevel.DEBUG, R.string.msg_dc_askip_no_key),
|
||||
MSG_DC_ASKIP_NOT_ALLOWED (LogLevel.DEBUG, R.string.msg_dc_askip_not_allowed),
|
||||
MSG_DC_ASYM (LogLevel.DEBUG, R.string.msg_dc_asym),
|
||||
|
||||
@@ -591,6 +591,18 @@ public class PgpDecryptVerifyOperation extends BaseOperation<PgpDecryptVerifyInp
|
||||
// get subkey which has been used for this encryption packet
|
||||
secretEncryptionKey = secretKeyRing.getSecretKey(subKeyId);
|
||||
|
||||
if (!secretEncryptionKey.canEncrypt()) {
|
||||
secretEncryptionKey = null;
|
||||
log.add(LogType.MSG_DC_ASKIP_BAD_FLAGS, indent + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!secretEncryptionKey.getSecretKeyType().isUsable()) {
|
||||
secretEncryptionKey = null;
|
||||
log.add(LogType.MSG_DC_ASKIP_UNAVAILABLE, indent + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* secret key exists in database and is allowed! */
|
||||
asymmetricPacketFound = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user