login about faq

We have been asked to connect to an SFTP server using an RSA public key.

I generate the keys using the Java Keytool and store them in a Java Key Store (JKS)

How do I access and use the private key?

asked Jul 24 '12 at 09:28

chilkat's gravatar image

chilkat ♦♦
11.8k316358420


Chilkat now has a JavaKeyStore object. See the online examples and reference documentation. This answer (below) is no longer the easiest solution...

The solution is to export the key to another format, such as PEM (PKCS8) or .p12 (PFX). This StackOverflow web page shows how to convert to PEM: http://stackoverflow.com/questions/652916/converting-a-java-keystore-into-pem-format

The Chilkat classes can be used to convert keys to virtually any format.

To use the private key with Chilkat SSH/SFTP, it needs to be imported into a Chilkat.SshKey object (or depending on the programming language it may be CkSshKey, CkoSshKey, etc.)

The SshKey object can import private keys from:
1) OpenSSH private-key file format
2) PuTTY private-key file format
3) XML format, which is Chilkat specific.

The Chilkat.PrivateKey class an import RSA keys from the following formats: PEM, PKCS8, binary DER, PVK, and XML.

The Chilkat.PrivateKey can export to all of these formats as well.

Here's the procedure to get the Java Key Store private key into a Chilkat.SshKey object:
1) Follow the instructions in the StackOverflow article to export the private key from JKS to PEM.
2) Load a Chilkat.PrivateKey object with the PEM.
3) Export from Chilkat.PrivateKey to XML.
4) Load the XML into a Chilkat.SshKey object.

link

answered Jul 24 '12 at 09:41

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

edited Oct 04 '14 at 12:18

Chilkat now as a JavaKeyStore object. See the online reference documentation and examples..

link

answered Oct 04 '14 at 12:16

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×200
×21
×7
×2
×1

Asked: Jul 24 '12 at 09:28

Seen: 2,508 times

Last updated: Oct 04 '14 at 12:18

powered by OSQA