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
crypto/rsa: GenerateKey never returns on some values of bits #16596
Comments
Docs issue. crypto/rsa.GenerateKey doesn't support generating
toy keys (<7 bits).
|
How about returning an error or even panicking? |
@minux doesn't seem like it works for even 8 bit keys https://play.golang.org/p/a7Ig2HcKzz, but it does work for 7 bits. |
A panic would be fine. But an error would be even better, since the function already returns an error. |
8 bit key generation is failing because of how prime numbers are generated, only possible 4 bit prime that can be generated is 13 while the function requires two distinct primes. 7 works as it generates one 4 bit and one 3 bit prime similar case for 5 |
CL https://golang.org/cl/25561 mentions this issue. |
CL https://golang.org/cl/28969 mentions this issue. |
Please answer these questions before submitting your issue. Thanks!
go version
)?go1.6.3
go env
)?windows10/amd64
ubuntu16.04/amd64
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
https://play.golang.org/p/gYYUDxj6Z5
The text was updated successfully, but these errors were encountered: