email-extract-openpgp-certs(1)
π email-extract-openpgp-certs β the email-extract-openpgp-certs(1) page, but make it cute β¨
okay bestie, sit down, hydrate, because this little tool is so useful and also so chaotic. it's from the User Commands section, it's a one-liner (literally, see below), and it will absolutely hand you a pile of OpenPGP certs straight out of an email. let's get into it π
πΈ NAME πΈ
email-extract-openpgp-certs β extract OpenPGP certificates from an e-mail π¦
like. it goes into an email and it pulls out the certs. that's the whole vibe.
β¨ SYNOPSIS β¨
email-extract-openpgp-certs <message.eml | gpg --import
that's it. that's the whole interface. pipe it in, pipe it out, and you're on your way to gpg --import. iconic behaviour honestly π
π DESCRIPTION π
so email-extract-openpgp-certs digs through an e-mail and extracts all the things it can find that look like they might be OpenPGP certificates, and then it produces them on standard output. it's giving "search party but for keys" π
note the "might be" β we'll get to that in LIMITATIONS, and it is a whole thing, but for now: it finds stuff, it prints stuff. slay.
rn it currently knows about how to find OpenPGP certificates in two places:
- as attachments of MIME type
application/pgp-keysπ - as
Autocrypt:style headers π¨
that's the whole toolkit for now. no cap.
π OPTIONS π
None.
bestie there are literally no options. zero flags. no --help, no --verbose, no nothing. the tool said "I contain multitudes but not flags." periodt π
β¨
π EXAMPLE π
okay here's the iconic workflow, verbatim:
$ notmuch show --format-raw id:b7e48905-842f@example.net >test.eml
$ email-extract-openpgp-certs <test.eml | gpg --import
first you dump the raw message out of notmuch into test.eml, then you feed it straight into this tool and straight into gpg --import. no middleman, no temp files, no drama. it's giving pipeline main character energy π«Ά
π LIMITATIONS π
okay bestie this is the part where we get real, because there is a lot here and you need to hear all of it.
email-extract-openpgp-certscurrently does not try to decrypt encrypted e-mails, so it cannot find certificates that are inside the message's cryptographic envelope. if the cert is locked inside the encryption, this tool just... doesn't see it. it's not going in there. it's not that kind of tool πemail-extract-openpgp-certsdoes not attempt to validate the certificates it finds in any way. it does not ensure that they are valid OpenPGP certificates, or even that they are of a sane size. it does not try to establish any relationship between the extracted certificates and the messages in which they are sent. for example, it does not check theAutocryptaddr=attribute against the message'sFrom:header.
so like. it does zero vibe checks. it does zero fact checks. it will hand you a 400MB blob and a cert from a totally different person and be like "here you go bestie π". do not trust it to have done the thinking for you, because it has not. the thinking is your job.
- Importing certificates extracted from an arbitrary e-mail in this way into a curated keyring is not a good idea. better to extract into an ephemeral location, inspect, filter, and then selectively import.
fr fr. do NOT dump random internet certs straight into your nice curated keyring. that keyring is a curated gallery, not a junk drawer. extract somewhere temporary, look at what you got, filter it, and only then import the ones you actually trust. trust the process, not the pipeline π
π SEE ALSO π
go read these too, bestie, they're the supporting cast:
gpg(1)https://autocrypt.orghttps://tools.ietf.org/html/rfc4880https://tools.ietf.org/html/rfc3156
π AUTHOR π
email-extract-openpgp-certs and this manpage were written by Daniel Kahn Gillmor, with guidance and advice from many others. shoutout to the whole committee, we love a collaborative effort π«Ά
okay that's the whole page!! now go extract some certs, but remember: extract into ephemeral, inspect, filter, then import. that's the mantra. say it with me. π§
this lil writeup is living under perl v5.40.1 from the Debian Project β mwah, thanks for having us, catch you in the next manpage πππ¦
π¦ where this page comes from
- debian trixie: mailscripts 30-2
- ubuntu questing: mailscripts 30-2
- ubuntu resolute: mailscripts 30-2build1
- ubuntu stonking: mailscripts 31-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms