From c3d417bfc910abe06996d1412c2dd493d2a1a86a Mon Sep 17 00:00:00 2001 From: Andrew Engelbrecht Date: Fri, 24 Jul 2015 17:14:52 -0400 Subject: [PATCH] fixed bug, removed stale code piece_type is set to "signature", not "message" if it is an armored signature. we shouldn't include plaintext unless we don't need further nested signatures. --- edward | 16 ++++++---------- tests/gpg-flatten-4.out | 1 - 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/edward b/edward index b0fb8e6..50b94fd 100755 --- a/edward +++ b/edward @@ -800,22 +800,18 @@ def flatten_decrypted_payloads (eddymsg_obj, get_signed_part): return flat_string for piece in eddymsg_obj.payload_pieces: - if piece.piece_type == "text": - flat_string += piece.string - if (get_signed_part): # don't include nested encryption - if (piece.piece_type == "message") \ - and (piece.gpg_data != None) \ - and (piece.gpg_data.decrypted == False): - flat_string += flatten_decrypted_payloads(piece.gpg_data.plainobj, get_signed_part) - - elif ((piece.piece_type == "clearsign") \ + if ((piece.piece_type == "clearsign") \ or (piece.piece_type == "detachedsig") \ or (piece.piece_type == "signature")) \ and (piece.gpg_data != None): # FIXME: the key used to sign this message needs to be the one that is used for the encrypted reply. - flat_string += flatten_decrypted_payloads (piece.gpg_data.plainobj, get_signed_part) + flat_string += flatten_decrypted_payloads (piece.gpg_data.plainobj, False) + break + else: + if piece.piece_type == "text": + flat_string += piece.string return flat_string diff --git a/tests/gpg-flatten-4.out b/tests/gpg-flatten-4.out index ae4f5f2..3eb79b8 100644 --- a/tests/gpg-flatten-4.out +++ b/tests/gpg-flatten-4.out @@ -6,7 +6,6 @@ Hello, I am Edward, the friendly GnuPG bot. I received your message and decrypte > > let's see how it works! > -> Your signature was verified. -- 2.25.1