From 94152da2ef18a673a996e3d5cfb3780a8f5f7feb Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 28 Nov 2022 23:12:51 +0100 Subject: Matrix: ignore expired and revoked signatures for gpg encrypt --- src/plugins/Matrix.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/plugins/Matrix.cpp') diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index d93c64a..6040edd 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -123,6 +123,7 @@ namespace QuickMedia { string_split(output, '\n', [&](const char *str, size_t size) { GpgLineType line_type = GpgLineType::UNKNOWN; int column = 0; + bool invalid_signature = false; string_split_view(std::string_view(str, size), ':', [&](const char *str, size_t size) { std::string_view section(str, size); @@ -131,8 +132,11 @@ namespace QuickMedia { line_type = GpgLineType::UID; else if(section == "fpr") line_type = GpgLineType::FPR; + } else if(column == 1) { + if(line_type == GpgLineType::UID) + invalid_signature = (section == "e" || section == "r"); // Expired or revoked } else if(column == 9) { - if(line_type == GpgLineType::UID) { + if(line_type == GpgLineType::UID && !invalid_signature) { // Assumes that each uid is preceeded with fpr const std::string user_email = std::string(gpg_display_name_extract_email(section)); if(!user_email.empty() && users_by_email.find(user_email) != users_by_email.end()) { -- cgit v1.2.3