News for hackers. Stuff that matters.
Re:Why does my SSH private key still work after changing som... by ulrikrasmussen on Saturday December 31, 2022 @02:30AM (#34194427)
I'm a bit uncomfortable with the fact that the ASN.1 encoding is actually inconsistent but that the implementation happily ignores that and just uses the derived values. Since these values are entirely redundant, it feels like a bad design to include them in the key file. I guess the point of them is to make operations faster, and therefore they have to be cached to make any sense.
Re:Why does my SSH private key still work after changing som... by ausudhz on Saturday December 31, 2022 @02:38AM (#34194457)
If you read the response you'd realize that it depends on how the key is generated.

Is not a "bad design", is a feature that allows to include or exclude derived values, if you do so then the original values are used and the encoded private key would be smaller.

The reason why they'd keep the original values when the derived are available might have to do with backwards compatibility and/or legacy constraint

Re:Why does my SSH private key still work after changing som... by Dylan16807 on Saturday December 31, 2022 @06:32AM (#34195515)
> If you read the response you'd realize that it depends on how the key is generated.

Where does it say or imply that? When I read the answer it sounds like using them is optional but generating them is mandatory.

Re:Why does my SSH private key still work after changing som... by ausudhz on Saturday December 31, 2022 @06:37AM (#34195547)
> With this optimization, the values of n, e and d are not required, hence are ignored by typical implementations whenever p, q, dp, dq and qinv are available*

> *at least for OpenSSH, they do not have to be present: setting p=q=1 and dp=dq=qinv=0 makes the implementation use n and d.

https://crypto.stackexchange.com/questions/31807/why-does-my...

Re:Why does my SSH private key still work after changing som... by Dylan16807 on Saturday December 31, 2022 @06:53AM (#34195649)
I misread the second quote. I suppose that is evidence, but setting them to an incorrect value suggests that this might not be a valid file even if it works.
Re:Why does my SSH private key still work after changing som... by layer8 on Saturday December 31, 2022 @02:10PM (#34199640)
This is a particularity of OpenSSH though and not supported by RFC 8017. The fields are mandatory and required by the spec to contained the correct values.