-
Notifications
You must be signed in to change notification settings - Fork 364
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
Supplied key (org.apache.sshd.common.config.keys.OpenSshCertificateImpl) is not a RSAPublicKey instance #650
Comments
The server side of user authentication with OpenSshCertificates was not fully implemented, and apparently is lacking tests. See issue SSHD-1161. The real cause of the problem you encounter is in mina-sshd/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/UserAuthPublicKey.java Line 95 in 7b19f6b
and mina-sshd/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/UserAuthPublicKey.java Line 132 in 7b19f6b
If the key is an OpenSshCertificate, So, to answer your questions: it happens because there is a bug. There are no dangers to your modification, but it'll work only for RSA keys. The real fix has to be in mina-sshd/sshd-core/src/main/java/org/apache/sshd/client/kex/DHGClient.java Lines 184 to 186 in 7b19f6b
Note that there are other bits of authenticating with a certificate missing on the server side: mina-sshd/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/UserAuthPublicKey.java Lines 108 to 110 in 7b19f6b
|
Yes, the fundamental problem is that when initializing Signature, instead of getting cert publickey from OpenSshCertificate, OpenSshCertificate is directly passed in as the public key.
|
Sure, if you can provide a PR with the fix and tests with different certificates/key types, that'd be great. |
OK, I will write my PR in the next few weeks after work, and I hope my work can make a small contribution to this open source project. |
Version
2.8.0
Bug description
I overwrote the authenticate function of the PublickeyAuthenticator.java and registered it with the ssh server.
But when the client provides the key and certificate, MINA SSHD displays an error:
After debugging, I found that the problem is that when MINA SSHD initializes the signature verifier of the public key, the public key passed in is of type OpenSshCertificateImpl, while Signature expects an RSAPublicKey object. Why does this problem occur? How can I solve it?
Actual behavior
I rewrote the initVerifier function in SignatureRSA.java and now I can login correctly.
Old initVerifier function:
I overwrote the initVerifier function:
I am still curious as to why this happens? And whether there are any hidden dangers in my modification.
`
Relevant log output
No response
Other information
No response
The text was updated successfully, but these errors were encountered: