[ 
https://issues.apache.org/jira/browse/SSHD-984?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17094592#comment-17094592
 ] 

Lyor Goldstein edited comment on SSHD-984 at 4/28/20, 3:15 PM:
---------------------------------------------------------------

Then attach the ZIP and I will see if I can find a home for it in the SSHD tree 
- then suggest it to you so we can have a PR over which we can discuss the 
code. Alternatively, I am OK with placing the code under the 
{{org.apache.sshd.common.config.keys.loader.openssh}} package for now and then 
re-factor it as needed.

In any case, since you are already working on it I rely on your discretion to 
decide when you think it is ready for some initial review and/or discussion.


was (Author: lgoldstein):
Then attach the ZIP and I will see if I can find a home for it in the SSHD tree 
- then suggest it to you so we can have a PR over which we can discuss the 
code. Alternatively, I am OK with placing the code under the 
{{org.apache.sshd.common.config.keys.loader.openssh}} package for now and then 
re-factor it as needed.

> Utility method to export KeyPair in OpenSSH format
> --------------------------------------------------
>
>                 Key: SSHD-984
>                 URL: https://issues.apache.org/jira/browse/SSHD-984
>             Project: MINA SSHD
>          Issue Type: New Feature
>    Affects Versions: 2.4.0
>            Reporter: David Ostrovsky
>            Priority: Minor
>
> There are ongoing efforts in Gerrit Code Review and JGit projects to remove 
> dependency on JSch library: [1], [2]. Instead, MINA SSSD should be used on 
> both: client and server sides.
> One difficulty we are facing is the fact the MINA SSHD currently doesn't 
> provide any means to export generated KeyPair in OpenSSH format.
> Thomas Wolf added recently the ability to read encrypted OpenSSH private keys 
> in context of SSHD-708.
> With JSch this code would do the job:
> {code:java}
>   public static com.jcraft.jsch.KeyPair genSshKey() throws JSchException {
>     JSch jsch = new JSch();
>     return KeyPair.genKeyPair(jsch, KeyPair.ECDSA, 256);
>   }
>   public static String publicKey(com.jcraft.jsch.KeyPair sshKey, @Nullable 
> String comment)
>       throws UnsupportedEncodingException {
>     ByteArrayOutputStream out = new ByteArrayOutputStream();
>     sshKey.writePublicKey(out, comment);
>     return out.toString(US_ASCII.name()).trim();
>   }
>   public static byte[] privateKey(com.jcraft.jsch.KeyPair keyPair) {
>     ByteArrayOutputStream out = new ByteArrayOutputStream();
>     keyPair.writePrivateKey(out);
>     return out.toByteArray();
>   }
> {code}
> [1] [https://bugs.eclipse.org/bugs/show_bug.cgi?id=540727]
>  [2] [https://bugs.chromium.org/p/gerrit/issues/detail?id=12599]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org

Reply via email to