summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2019-11-25 16:45:50 -0500
committerSean Whitton <spwhitton@spwhitton.name>2019-11-28 11:09:01 -0700
commit229f295232e3abd3679bbb4ed258b81fc68a1931 (patch)
treee5d0006bf1692746dcb11bc7365b62720c2945c1
parent15ed2184e61e40a35e56921aa57a49726f56b5c2 (diff)
downloadmailscripts-229f295232e3abd3679bbb4ed258b81fc68a1931.tar.gz
email-print-mime-structure: Change pipe_decrypt to pipe_transform
I plan to use the same harness to try to transform other leaf subparts that might be extractable into a MIME subtree, not just decryption. So give it a more generic name. No functional change. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net> Acked-by: Sean Whitton <spwhitton@spwhitton.name>
-rwxr-xr-xemail-print-mime-structure8
1 files changed, 4 insertions, 4 deletions
diff --git a/email-print-mime-structure b/email-print-mime-structure
index 4de0789..6d7b0af 100755
--- a/email-print-mime-structure
+++ b/email-print-mime-structure
@@ -114,16 +114,16 @@ class MimePrinter(object):
if self.args.pgpkey:
cryptopayload = self.pgpy_decrypt(self.args.pgpkey, ciphertext)
if cryptopayload is None and self.args.use_gpg_agent:
- cryptopayload = self.pipe_decrypt(ciphertext, ['gpg', '--batch', '--decrypt'])
+ cryptopayload = self.pipe_transform(ciphertext, ['gpg', '--batch', '--decrypt'])
elif flavor == EncType.SMIME:
if self.args.cmskey:
for keyname in self.args.cmskey:
cmd = ['openssl', 'smime', '-decrypt', '-inform', 'DER', '-inkey', keyname]
- cryptopayload = self.pipe_decrypt(ciphertext, cmd)
+ cryptopayload = self.pipe_transform(ciphertext, cmd)
if cryptopayload:
return cryptopayload
if self.args.use_gpg_agent:
- cryptopayload = self.pipe_decrypt(ciphertext, ['gpgsm', '--batch', '--decrypt'])
+ cryptopayload = self.pipe_transform(ciphertext, ['gpgsm', '--batch', '--decrypt'])
if cryptopayload is None:
logging.warning(f'Unable to decrypt')
return cryptopayload
@@ -145,7 +145,7 @@ class MimePrinter(object):
pass
return None
- def pipe_decrypt(self, ciphertext:bytes, cmd:List[str]) -> Optional[Message]:
+ def pipe_transform(self, ciphertext:bytes, cmd:List[str]) -> Optional[Message]:
inp:int
outp:int
inp, outp = os.pipe()