diff --git a/plugins/openpgp/po/en.po b/plugins/openpgp/po/en.po index 2a2a9aaa..4a545bc3 100644 --- a/plugins/openpgp/po/en.po +++ b/plugins/openpgp/po/en.po @@ -20,7 +20,7 @@ msgstr "" #: plugins/openpgp/src/account_settings_entry.vala:72 msgid "No keys available. Generate one!" -msgstr "" +msgstr "No keys available. Generate one or check if your keys aren't expired or revoked!" #: plugins/openpgp/src/account_settings_entry.vala:101 msgid "Select key" diff --git a/plugins/openpgp/po/ru.po b/plugins/openpgp/po/ru.po index f3628e57..b2f2e4e3 100644 --- a/plugins/openpgp/po/ru.po +++ b/plugins/openpgp/po/ru.po @@ -31,7 +31,7 @@ msgstr "Ошибка в GnuPG" #: plugins/openpgp/src/account_settings_entry.vala:72 msgid "No keys available. Generate one!" -msgstr "Нет доступных ключей. Стоило бы сгенерировать один!" +msgstr "Нет доступных ключей. Создайте как минимум один, либо проверьте что уже существующие (ранее созданные) ключи не были отозваны или срок их действия не закончился!" #: plugins/openpgp/src/account_settings_entry.vala:101 msgid "Select key" diff --git a/plugins/openpgp/src/account_settings_entry.vala b/plugins/openpgp/src/account_settings_entry.vala index 7c99942f..366718c3 100644 --- a/plugins/openpgp/src/account_settings_entry.vala +++ b/plugins/openpgp/src/account_settings_entry.vala @@ -160,4 +160,4 @@ public class AccountSettingsEntry : Plugins.AccountSettingsEntry { return stack; } } -} \ No newline at end of file +} diff --git a/plugins/openpgp/src/encryption_list_entry.vala b/plugins/openpgp/src/encryption_list_entry.vala index 68a31f38..2ac3460a 100644 --- a/plugins/openpgp/src/encryption_list_entry.vala +++ b/plugins/openpgp/src/encryption_list_entry.vala @@ -40,6 +40,16 @@ private class EncryptionListEntry : Plugins.EncryptionListEntry, Object { return; } + GPG.Key key_check = GPGHelper.get_public_key(db.get_account_key(conversation.account)); + if (key_check.expired || key_check.revoked) { + string status_str = key_check.expired ? " has expired." : " has been revoked."; + debug("GPG public key %s is NOT fine for encryption: it %s.\n", key_check.fpr, status_str); + input_status_callback(new Plugins.InputFieldStatus("Your GPG key " + key_check.fpr + status_str, + Plugins.InputFieldStatus.MessageType.ERROR, + Plugins.InputFieldStatus.InputState.NO_SEND)); + return; + } + if (conversation.type_ == Conversation.Type.CHAT) { string? key_id = stream_interactor.get_module(Manager.IDENTITY).get_key_id(conversation.account, conversation.counterpart); if (key_id == null) { diff --git a/plugins/openpgp/src/gpgme_helper.vala b/plugins/openpgp/src/gpgme_helper.vala index 956ea1c8..8fda3e07 100644 --- a/plugins/openpgp/src/gpgme_helper.vala +++ b/plugins/openpgp/src/gpgme_helper.vala @@ -112,7 +112,12 @@ public static Gee.List get_keylist(string? pattern = null, bool secret_only try { while (true) { Key key = context.op_keylist_next(); - keys.add(key); + if (!key.expired && !key.revoked) { + debug("PGP Key " + key.fpr + " is valid!"); + keys.add(key); + } else { + debug("PGP Key " + key.fpr + " is either expired or revoked!"); + } } } catch (Error e) { if (e.code != GPGError.ErrorCode.EOF) throw e;