in reply to Email: remove S/MIME or PGP signature?

Hi, can't you just run gpg's delsig command on them? Also procmail can do it in it's processing. See filtering mail . Search that page for X-PGP, it shows how to strip it with sed. You could emulate that sed program with Perl. Maybe show a sample mail with sig, and someone can give you a good regex.

I'm not really a human, but I play one on earth. ..... an animated JAPH
  • Comment on Re: Email: remove S/MIME or PGP signature?

Replies are listed 'Best First'.
Re^2: Email: remove S/MIME or PGP signature?
by tlhackque (Beadle) on Apr 09, 2017 at 08:20 UTC
    It's more complicated than stripping the signature. Just deleting the signature block produces a malformed message - and one that a good MUA will flag since it says it's signed, but no signature block is present. A regex isn't the problem - I can easily write those. The problem is that signing an e-mail takes headers (e.g. content-*) from the main body of the message and pushes them into a message/signed part - with a new boundary. Then the signature block is added, and the headers for the message/signed part replace those in the main body. I think that in theory, one message can have multiple signatures. To undo this requires finding the message/signed part, extracting its headers, deleting its headers & boundaries, deleting the signature block(s), and putting the headers back into the main message. The Content-type ;protocol field contains the MIME type for the signature. And, it can be necessary to do this recursively, since a message can consist of multiple signed parts (e.g. when a message contains several signed attached e-mails. Note that one can have pgp-signed attachments to an S/MIME-signed message. And vice-versa.) gpg delsig probably does the right thing for one level of PGP(I'm not a PGP user) - thanks for that suggestion. But will it handle a mix of PGP and S/MIME? And attachments (without detaching them?) S/MIME has the same issue, but I haven't found a tool for that. Anyhow, while I appreciate the suggestion, it doesn't solve the generic problem.