Open bpizzi opened 2 years ago
cc @FiloSottile @agl @katiehockman @rolandshoemaker
Why are you using a key with such a large exponent? Is this the default in lshd, or a key you've generated yourself?
We explicitly don't support such large exponents, since they provide little to no benefit. See https://github.com/golang/go/issues/3161 and https://codereview.appspot.com/5650067 for previous discussion (also https://www.imperialviolet.org/2012/03/16/rsae.html).
Hey, thanks for having a look at it.
Why are you using a key with such a large exponent? Is this the default in lshd, or a key you've generated yourself?
Actually I don't have a say on this, I'm trying to connect to a server where the key is as-is and can't be changed (its an appliance provided by a BigCorp). I not sure how the key have been generated.
We explicitly don't support such large exponents, since they provide little to no benefit. See #3161 and https://codereview.appspot.com/5650067 for previous discussion (also https://www.imperialviolet.org/2012/03/16/rsae.html).
Thanks for this, as its nice to have some background intel on how this came to be.
Do you think the decision for not handling big exponent is susceptible to being re evaluated in the regard of the present issue? Otherwise I'll move on, and at least we'll have a searchable issue here referencing for exponent too large
;)
Thanks for the context.
This issue has popped up sparingly in the last decade since this was first discussed. Given how rare it is, and without some serious issue with RSA that requires everyone to switch to giant exponents, I don't think we'll be reconsidering this decision.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
When trying to open a ssh session to a LSH server (
lshd-1.4.3, secsh protocol version 2.0
).What did you expect to see?
No error on
NewSession()
What did you see instead?
2022/01/20 12:02:05 dial: ssh: handshake failed: ssh: exponent too large
OTOH, openssh client connects successfully, giving that I specifies the expected values for
KexAlgorithms
andHostKeyAlgorithms
(setting those in Go's ssh config doesn't help).As a workaround, I managed to successfully establish the session by changing the max bit len to 31 (instead of actually 24) in x/crypto/ssh/keys.go:353 in
ParseRSA()
.