As we prepare for S/MIME decryption, we want to identify pgp
decryption as just one type of decryption.  There is no functional
change here.

Signed-off-by: Daniel Kahn Gillmor <d...@fifthhorseman.net>
---
 email-print-mime-structure | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/email-print-mime-structure b/email-print-mime-structure
index 4f165b1..27fb532 100755
--- a/email-print-mime-structure
+++ b/email-print-mime-structure
@@ -78,15 +78,16 @@ class MimePrinter(object):
             nbytes = len(payload)
 
         print(f'{prefix}{z.get_content_type()}{cset}{disposition}{fname} 
{nbytes:d} bytes')
-        try_decrypt:bool = self.args.pgpkey or self.args.use_gpg_agent
+        cryptopayload:Optional[Message] = None
+        ciphertext:Union[List[Message],str,bytes,None] = None
+        try_pgp_decrypt:bool = self.args.pgpkey or self.args.use_gpg_agent
 
-        if try_decrypt and \
+        if try_pgp_decrypt and \
            (parent is not None) and \
            (parent.get_content_type().lower() == 'multipart/encrypted') and \
            (str(parent.get_param('protocol')).lower() == 
'application/pgp-encrypted') and \
            (num == 2):
-            cryptopayload:Optional[Message] = None
-            ciphertext:Union[List[Message],str,bytes,None] = z.get_payload()
+            ciphertext = z.get_payload()
             if not isinstance(ciphertext, str):
                 logging.warning('encrypted part was not a leaf mime part 
somehow')
                 return
@@ -97,6 +98,8 @@ class MimePrinter(object):
             if cryptopayload is None:
                 logging.warning(f'Unable to decrypt')
                 return
+
+        if cryptopayload is not None:
             newprefix = prefix[:-3] + ' '
             print(f'{newprefix}↧ (decrypts to)')
             self.print_tree(cryptopayload, newprefix + '└', z, 0)
-- 
2.24.0

Reply via email to