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

raskey.py is hardcoded with "ssh-rsa" in places where we need support for rsa-sha2-256 and other versions #1997

Closed
aswanidutt opened this issue Mar 7, 2022 · 7 comments

Comments

@aswanidutt
Copy link

No description provided.

@aswanidutt
Copy link
Author

aswanidutt commented Mar 7, 2022

here: def asbytes(self):
m = Message()
m.add_string("ssh-rsa") # need to be able to choose different versions of sha
m.add_mpint(self.public_numbers.e)
m.add_mpint(self.public_numbers.n)
return m.asbytes()

@jun66j5
Copy link
Contributor

jun66j5 commented Mar 7, 2022

No. That code should be correct. Please describe the details if you encounter an issue with the latest version of paramiko.

@aswanidutt
Copy link
Author

aswanidutt commented Mar 8, 2022

when we create a cert and try to sign it using paramiko, its not giving us option to sign the cert with SHA2 its hardcoded to sign and verify only with SHA1(ssh-rsa), though it has mentioned the different algorithms(Hashes) in that file
HASHES = {
"ssh-rsa": hashes.SHA1,
"ssh-rsa-cert-v01@openssh.com": hashes.SHA1,
"rsa-sha2-256": hashes.SHA256,
"rsa-sha2-256-cert-v01@openssh.com": hashes.SHA256,
"rsa-sha2-512": hashes.SHA512,
"rsa-sha2-512-cert-v01@openssh.com": hashes.SHA512,
}
its hard coded in the line 95 to "ssh-rsa", because of this we are unable to sign(verify after the signing part) for the cert.
I am talking about the file rsakey.py file

@jun66j5
Copy link
Contributor

jun66j5 commented Mar 8, 2022

I've posted PR #1977 to fix publickey authentication with signed RSA key. Try it. See also #1963.

I believe the asbytes() is correct.

@11chri
Copy link

11chri commented Mar 11, 2022

@jun66j5 I just checked your PR on Paramiko 2.9.2 and it fixes #1963

@aswanidutt
Copy link
Author

aswanidutt commented Mar 14, 2022

I dont see the change of m.add_string("ssh-rsa") to
m.add_string(algorithm) in the rsakey.py file, it is not reflected in the version 2.10.1.
though its there in the change 363a28d

@bitprophet
Copy link
Member

Jun's fix from #1977 will be out in 2.9.3 and 2.10.3.

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

4 participants