Code: Select all
sshServer.setPublickeyAuthenticator(publicKeyAuth);
Code: Select all
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
Warum tritt dieses Problem auf? Wie kann ich es lösen?
==========update==========
I Ich habe die initVerifier-Funktion in SignatureRSA.java umgeschrieben und jetzt kann ich mich korrekt anmelden.
Alte initVerifier-Funktion:
Code: Select all
public void initVerifier(SessionContext session, PublicKey key) throws Exception {
super.initVerifier(session, key);
RSAKey rsaKey = ValidateUtils.checkInstanceOf(key, RSAKey.class, "Not an RSA key");
verifierSignatureSize = getVerifierSignatureSize(rsaKey);
}
Code: Select all
public void initVerifier(SessionContext session, PublicKey key) throws Exception {
if (key instanceof OpenSshCertificate){
super.initVerifier(session, ((OpenSshCertificate) key).getCertPubKey());
RSAKey rsaKey = ValidateUtils.checkInstanceOf(((OpenSshCertificate) key).getCertPubKey(), RSAKey.class, "Not an RSA key");
verifierSignatureSize = getVerifierSignatureSize(rsaKey);
}else {
super.initVerifier(session, key);
RSAKey rsaKey = ValidateUtils.checkInstanceOf(key, RSAKey.class, "Not an RSA key");
verifierSignatureSize = getVerifierSignatureSize(rsaKey);
}
}