g3g4x5x6 created SSHD-1246:
------------------------------
Summary: for password-less authentication(PublicKeyIdentity)
Key: SSHD-1246
URL: https://issues.apache.org/jira/browse/SSHD-1246
Project: MINA SSHD
Issue Type: Question
Reporter: g3g4x5x6
I want to add PublicKeyIdentity
{code:java}
private ClientSession getSession(SshClient client) {
ClientSession session;
try {
session = client.connect(this.user, this.host,
this.port).verify(5000, TimeUnit.MILLISECONDS).getSession();
// session.addPasswordIdentity(this.pass);
log.debug(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>KeyPair>>>>>>>>>>>>>>>>>>>>>>>>>>>");
RSAPuttyKeyDecoder rsaPuttyKeyDecoder = new RSAPuttyKeyDecoder();
KeyPair keyPair = rsaPuttyKeyDecoder.loadKeyPairs(null,
new PuttyKeyReader(new
FileInputStream("C:\\Users\\G3G4X5X6\\Desktop\\UltimateShell\\ssh-key\\test1\\key.pub")),
new PuttyKeyReader(new
FileInputStream("C:\\Users\\G3G4X5X6\\Desktop\\UltimateShell\\ssh-key\\test1\\private.ppk")),
null).iterator().next();
session.addPublicKeyIdentity(keyPair);
session.auth().verify(15, TimeUnit.SECONDS);
session.setSessionHeartbeat(SessionHeartbeatController.HeartbeatType.IGNORE,
Duration.ofMinutes(3));
session.sendIgnoreMessage("".getBytes(StandardCharsets.UTF_8));
return session;
} catch (IOException | GeneralSecurityException e) {
e.printStackTrace();
DialogUtil.error(e.getMessage());
return null;
}
} {code}
{*}Error, but i don't know why, help!{*}{*}{*}
{code:java}
java.io.EOFException
at java.base/java.io.DataInputStream.readInt(DataInputStream.java:397)
at org.apache.sshd.putty.PuttyKeyReader.read(PuttyKeyReader.java:66)
at org.apache.sshd.putty.PuttyKeyReader.readInt(PuttyKeyReader.java:61)
at
org.apache.sshd.putty.RSAPuttyKeyDecoder.loadKeyPairs(RSAPuttyKeyDecoder.java:60)
at
com.g3g4x5x6.ui.panels.ssh.SshTabbedPane.getSession(SshTabbedPane.java:123)
...... {code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]