-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add key expiry #179
Comments
Hi @mdosch, we currently do not support this feature. If you're interested we'd welcome a PR with a new wrapper function around Thanks! |
I discovered that there is already an PR: #58 |
Unfortunately that PR never got merged because its parent PR in go-crypto was never followed up, therefore it is outdated and incompatible. In order to generate keys with expiration we have now this PR merged upstream: ProtonMail/go-crypto#64 |
Nothing from my side.
…On 05.06.2023 19:17, grixxie wrote:
@mdosch @wussler any update on this?
--
Reply to this email directly or view it on GitHub:
#179 (comment)
You are receiving this because you were mentioned.
Message ID: ***@***.***>
|
Hi. Sorry for hijacking this. Also interested in this feature and wanted to test it out. I tried adding version 3 according to v3#downloadinstall but fails, see below. go get github.com/ProtonMail/gopenpgp/v3
go: module github.com/ProtonMail/gopenpgp@upgrade found (v1.0.0), but does not contain package github.com/ProtonMail/gopenpgp/v3 However I am trying this and it seems to work using the latest commit: go get github.com/ProtonMail/gopenpgp/v3@8cdb29f42ab4
go: added github.com/ProtonMail/gopenpgp/v3 v3.0.0-20230914090609-8cdb29f42ab4 I can't seem to find the module that can generate a key with expiration date. In v2 I create the key the following way: rsaKey, err := helper.GenerateKey(name, email, passphrase, "rsa", rsaBits)
if err != nil {
log.Fatal(err)
} How can I access this function? |
@devasmith v3 is still under development and might still change. Nevertheless, it is possible to check out the current API. The github.com/ProtonMail/gopenpgp/v3/crypto
github.com/ProtonMail/gopenpgp/v3/profile
pgp := crypto.PGPWithProfile(profile.RFC4880())
// Generate pgp key with RFC4880 profile (RSA keys)
keyGenerationHandle := pgp.KeyGeneration().
AddUserId("Max Mustermann", "[email protected]").
Lifetime(5260000). // Sets the key liftetime in seconds i.e., expiration date
New()
key, err := keyGenerationHandle.GenerateKey()
if err != nil {
// ...
}
fmt.Println(key.Armor())
// Lock key
lockedKey, err := pgp.LockKey(key, []byte("password"))
if err != nil {
// ...
}
key.ClearPrivateParams()
fmt.Println(lockedKey.Armor()) |
Thank you! Work as expected. 🥇 |
Dear maintainers,
thank you very much for your libraries. While using it one question occurred to me: How do I set the key expiry? I haven't found any way to set an expiry date.
The text was updated successfully, but these errors were encountered: