ProtonMail/gopenpgp

Allow empty email for key generation

mdosch opened this issue · 3 comments

Dear gopenpgp maintainers,

thank you very much for your library as it makes OpenPGP easily usable in Go. I am using it to implement "XEP-0373: OpenPGP for XMPP" but I have an issue: The XEP requires the User ID to be in the format "xmpp:user@example.org" but gopenpgp/crypto requires an email to be set so I can only create "xmpp:user@example.org <xmpp:user@example.org>". Could you add a function to create keys more flexible to make the library also useful outside of the email use case? Or just change

if len(email) == 0 {
to accept empty email or name values.

Alternatively I was able to work around it by copying some stuff from your code into mine:

  • GopenPGP struct
  • var pgp
  • func getNow()
  • func getNowKeyGenerationOffset()
  • func getKeyGenerationTimeGenerator()
  • some code from GenerateKey() like cfg

This works as a PoC but I don't want to push it as my code is BSD-2-clause and yours is MIT and I don't know whether I am allowed to publish it if I copy some stuff from your code and also I don't know how this might affect copyright and so on.
So I'd be very happy if you could add a way to be more flexible in the used User ID and I don't have to deal with licenses, copyright and so on. :)

Hi @mdosch, thank you for your contribution.

I'd prefer to drop the condition on email and name rather than duplicating the function to generate keys, I've taken care of this in #180, will fix the CI and merge it.

Thank you very much. :)