ProtonMail / gopenpgp

A high-level OpenPGP library
https://gopenpgp.org
MIT License
1.07k stars 117 forks source link

Parameterize expiration for generation of keys #54

Open klische opened 4 years ago

klische commented 4 years ago

When generating keys (https://github.com/ProtonMail/gopenpgp#generate-key), there are no parameters to set the expiration date for the PGP keys.

There seems to be SigLifetimeSecs, KeyLifetimeSecs in the packet signature, but is not implemented anywhere.

Can we get this feature? Happy to help with a PR potentially.

wussler commented 4 years ago

Hi @klische, your contribution would be more than welcome.

I'd personally add a function in crypto/key.go:

func GenerateKeyWithExpiration(name, email string, keyType string, bits int, expiration int64) (*Key, error)