You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But when the client provides the key and certificate, MINA SSHD displays an error:
2024-12-25 17:29:30.882 sshd-SshServer[53600a30](port=2222)-nio2-thread-5 WARN org.apache.sshd.server.session.ServerUserAuthService.warn - handleUserAuthRequestMessage(ServerSessionImpl[null@/127.0.0.1:56562]) Failed (InvalidKeyException) to authenticate using factory method=publickey: Supplied key (org.apache.sshd.common.config.keys.OpenSshCertificateImpl) is not a RSAPublicKey instance
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:
If the key is an OpenSshCertificate, initVerifier should be called with key.getCertPubKey(), not with key.
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 UserAuthPublicKey (server side) so that it works for all key types. Similar to how it's done in
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: