Here's the code from SSHD 1.0 I think the javadoc on the web site is outdated, i'll try to fix it.
https://github.com/apache/mina-sshd/blob/sshd-1.0.0/sshd-core/src/main/java/org/apache/sshd/common/util/SecurityUtils.java#L202 2015-10-31 16:24 GMT+01:00 Jonathan S. Fisher < [email protected]>: > Using Jsch, I was able to parse the keys: > > JSch jSch = new JSch(); > try { > com.jcraft.jsch.KeyPair jschKeypair = com.jcraft.jsch.KeyPair.load(jSch, > privateKey.getBytes(), publicKey.getBytes()); > jschKeypair.decrypt(keyPass); > byte[] fromAgent = jschKeypair.forSSHAgent(); > Buffer buffer = new Buffer(fromAgent); > return buffer.getKeyPair(); > } catch (JSchException | SshException e) { > throw new RuntimeException(e); > } > > However, is there a way to do this without bringing in Jsch? > > > On Sat, Oct 31, 2015 at 9:12 AM, Jonathan S. Fisher < > [email protected]> wrote: > > > > > > https://mina.apache.org/sshd-project/apidocs/org/apache/sshd/common/util/SecurityUtils.html > > > > Can you point me to that method in the docs? I'm not seeing it there... > > > > On Fri, Oct 30, 2015 at 5:59 PM, Guillaume Nodet <[email protected]> > > wrote: > > > >> You can try with > >> SecurityUtils.loadKeyPairIdentity > >> > >> 2015-10-30 17:36 GMT+01:00 Jonathan S. Fisher < > >> [email protected]>: > >> > >> > Hey guys, > >> > > >> > I've been pouring through examples and source code, and I cannot > figure > >> out > >> > how to do this. I have a pair of Strings that is the contents of a > >> user's > >> > id_ecdsa and id_ecdsa.pub. The private key is encrypted. > >> > > >> > Is there not a conversion utility class to go from OpenSSH to a > KeyPair > >> > anywhere? If not, what would be the shortest steps to write one? I > >> noticed > >> > the Buffer class and the SecurityUtils, but they don't seem to handle > >> > encryption. > >> > > >> > Thanks, > >> > -Jonathan > >> > > >> > -- > >> > Email Confidentiality Notice: The information contained in this > >> > transmission is confidential, proprietary or privileged and may be > >> subject > >> > to protection under the law, including the Health Insurance > Portability > >> and > >> > Accountability Act (HIPAA). The message is intended for the sole use > of > >> the > >> > individual or entity to whom it is addressed. If you are not the > >> intended > >> > recipient, you are notified that any use, distribution or copying of > the > >> > message is strictly prohibited and may subject you to criminal or > civil > >> > penalties. If you received this transmission in error, please contact > >> the > >> > sender immediately by replying to this email and delete the material > >> from > >> > any computer. > >> > > >> > > > > > > -- > Email Confidentiality Notice: The information contained in this > transmission is confidential, proprietary or privileged and may be subject > to protection under the law, including the Health Insurance Portability and > Accountability Act (HIPAA). The message is intended for the sole use of the > individual or entity to whom it is addressed. If you are not the intended > recipient, you are notified that any use, distribution or copying of the > message is strictly prohibited and may subject you to criminal or civil > penalties. If you received this transmission in error, please contact the > sender immediately by replying to this email and delete the material from > any computer. >
