The code is used to load the following keys: https://github.com/apache/mina-sshd/tree/master/sshd-core/src/test/resources/org/apache/sshd/client/config/keys
Isn't that what you need ? Fwiw, afaik, JSch can't load encrypted keys. 2015-11-02 17:00 GMT+01:00 Jonathan S. Fisher < [email protected]>: > If I could press you just a bit further.... > > I have the private key and the public key as separate strings in the > typical OpenSSH format. I noticed the source code for the > SecurityUtils. loadKeyPairIdentity() seems to invoke methods based around > PEM formats, which is not common at all for SSH. > > Is there a way to parse, combine, and convert the keys I have to PEM format > in Java? > > On Mon, Nov 2, 2015 at 9:44 AM, Jonathan S. Fisher < > [email protected]> wrote: > > > https://mina.apache.org/sshd-project/downloads.html > > > > Just noticed this is not showing a changelog or a download link for 1.0. > I > > saw v1.0 in Nexus, but since it wasn't listed as a release I figured it > was > > a fluke. > > > > On Sun, Nov 1, 2015 at 2:50 AM, Guillaume Nodet <[email protected]> > wrote: > > > >> 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. > >> > > >> > > > > > > -- > 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. >
