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

crypto/rsa: GenerateKey never returns on some values of bits #16596

Closed
steve-wang opened this issue Aug 4, 2016 · 7 comments
Closed

crypto/rsa: GenerateKey never returns on some values of bits #16596

steve-wang opened this issue Aug 4, 2016 · 7 comments

Comments

@steve-wang
Copy link

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    go1.6.3
  2. What operating system and processor architecture are you using (go env)?
    windows10/amd64
    ubuntu16.04/amd64
  3. What did you do?
    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

@minux
Copy link
Member

minux commented Aug 4, 2016 via email

@steve-wang
Copy link
Author

How about returning an error or even panicking?

@odeke-em
Copy link
Member

odeke-em commented Aug 4, 2016

@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.

@bradfitz
Copy link
Contributor

bradfitz commented Aug 4, 2016

A panic would be fine. But an error would be even better, since the function already returns an error.

@bradfitz bradfitz changed the title rsa.GenerateKey never returns on sepcial bits crypto/rsa: GenerateKey never returns on some values of bits Aug 4, 2016
@bradfitz bradfitz added this to the Go1.8Maybe milestone Aug 4, 2016
@shethchintan7
Copy link

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

@gopherbot
Copy link

CL https://golang.org/cl/25561 mentions this issue.

@agl agl self-assigned this Aug 19, 2016
@gopherbot
Copy link

CL https://golang.org/cl/28969 mentions this issue.

@golang golang locked and limited conversation to collaborators Sep 13, 2017
@rsc rsc unassigned agl Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants