aspose file tools*
The moose likes Security and the fly likes Import Key Pair(public/private) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Security
Bookmark "Import Key Pair(public/private)" Watch "Import Key Pair(public/private)" New topic
Author

Import Key Pair(public/private)

kamal palia
Greenhorn

Joined: Jul 20, 2012
Posts: 17
I have generated key pair into cacerts using keytool -genkey command and its generated successfuly.
Now i have to import same key pair with same alias name into another cacerts so how can i do this?
kamal palia
Greenhorn

Joined: Jul 20, 2012
Posts: 17
I got the command for copying key pair from one keystore to another keystore given below

C:\>keytool -import -keystore D:\key\keystore.jks -keystore D:\key\Server\keysstore.jks -storepass password -storepass password -alias merchantkey -alias merchantkey -keypass password -keypass password


but it is giving error
keytool error: java.lang.Exception: Input not an X.509 certificate

any idea?
Richard Tookey
Ranch Hand

Joined: Aug 27, 2012
Posts: 1067
    
  10

kamal palia wrote:
any idea?


That looks very very wrong! You need to look at the 'keytool' documentation.
kamal palia
Greenhorn

Joined: Jul 20, 2012
Posts: 17
I have two different application servers and generated key pair in one server and shared public key with client.
Now whenever client will send some encrypted data loadbalancer will try to send request to any one of the server, which means in both server private key should be available so for this purpose, i need to copy key pair from one app server jks file to another app server jks file.
So what's wrong in this?
Richard Tookey
Ranch Hand

Joined: Aug 27, 2012
Posts: 1067
    
  10

kamal palia wrote:
So what's wrong in this?


I was not indicating that your concept is flawed, though I do have reservations, only that the command line you are using is very very wrong and that you need to read the 'keytool' documentation. What is to stop you copying the whole 'cacerts' file from one machine to the other?


P.S. I do hope you are getting a CA to generate signed certificates or you are going to have two unauthenticated to each other and unknown to each other parties communicating very very securely.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Import Key Pair(public/private)