Skip to content
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

v6 key generation fails in fips only mode #262

Open
kruskall opened this issue Dec 20, 2024 · 1 comment
Open

v6 key generation fails in fips only mode #262

kruskall opened this issue Dec 20, 2024 · 1 comment

Comments

@kruskall
Copy link

trying to generate v6 keys fails in a fips only environment (GODEBUG=fips140=only on gotip or go 1.24)

code:

openpgp.NewEntity("somekey", "", "", &packet.Config{V6Keys: true})

stacktrace:

	panic: crypto/sha1: use of weak SHA-1 is not allowed in FIPS 140-only mode

goroutine 7 [running]:
panic()
	runtime/panic.go:787
crypto/sha1.New(...)
	crypto/sha1/sha1.go:115
github.com/ProtonMail/go-crypto/openpgp/packet.(*PublicKey).setFingerprintAndKeyId
	github.com/ProtonMail/[email protected]/openpgp/packet/public_key.go:306
github.com/ProtonMail/go-crypto/openpgp/packet.NewRSAPublicKey
	github.com/ProtonMail/[email protected]/openpgp/packet/public_key.go:91
github.com/ProtonMail/go-crypto/openpgp/packet.NewSignerPrivateKey
	github.com/ProtonMail/[email protected]/openpgp/packet/private_key.go:150
github.com/ProtonMail/go-crypto/openpgp.NewEntity
	github.com/ProtonMail/[email protected]/openpgp/key_generation.go:42

Seems to be caused by the fact the method is generating a v4 key and then upgrading to v6:

if err := primary.UpgradeToV6(); err != nil {
return nil, err
}

Is there a way to generate a v6 key directly ?

@twiss
Copy link
Member

twiss commented Dec 20, 2024

No, it's currently not possible. Probably the easiest thing to do is to (create a fork in order to) make v6 the default, and then downgrade to v4 when that's requested (if you still need that functionality as well).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants