How do I do Mathematica to a encrypt a message when someone has given me their public PGP key?

Does Mathematica have this functionality? Could I use Mathematica GenerateAsymmetricKeyPair[] to share a PGP key?

  • 2
    $\begingroup$ While I am interested to know if Mathematica has this functionality as well, this is one of the cases where I would highly recommend just using the dedicated software for it (gpg) if you're planning on using this in anything resembling a production style environment. Cryptography is not a very DIY friendly field. I couldn't figure out how to import an example PGP key myself, so I'm not entirely sure it can be done. $\endgroup$
    – eyorble
    Commented May 12, 2020 at 11:45
  • $\begingroup$ Agreed it doesn't look doable but here's to hoping that it does $\endgroup$ Commented May 21, 2020 at 13:04
  • $\begingroup$ A question related to your third one ("Could I use Mma [...] to share a PGP key?) is here, " Using Mma to print the keys in the strict sense is possible (see @SjoerdSmit's answer here), so the outstanding issue is whether one can get Mma to take the other required info and put it together with the key to generate the key block. $\endgroup$
    – ool
    Commented Mar 20, 2021 at 13:23

1 Answer 1


Unfortunately Mathematica does not support PGP key import and encryption/decryption. However, as of v 12.2 it does support import of PEM files (keys, certificates, etc)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.