[
https://issues.apache.org/jira/browse/SSHD-1246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Lyor Goldstein resolved SSHD-1246.
----------------------------------
Resolution: Information Provided
Opened SSHD-1247 as a separate issue
> Improve documentation on loading private/public keys from files
> ---------------------------------------------------------------
>
> Key: SSHD-1246
> URL: https://issues.apache.org/jira/browse/SSHD-1246
> Project: MINA SSHD
> Issue Type: Improvement
> Reporter: g3g4x5x6
> Assignee: Lyor Goldstein
> Priority: Minor
> Attachments: image-2022-02-17-14-15-49-444.png,
> image-2022-02-17-14-35-14-895.png, image-2022-02-17-14-35-25-762.png,
> image-2022-02-17-14-35-59-260.png, image-2022-02-17-14-41-09-601.png,
> private.ppk
>
>
> 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]