Since I just had to do it again and I managed to forget how I had this done at the first time - I am adding this post here...
First step is to convert both of them to DER format with following commands:
openssl pkcs8 -topk8 -nocrypt -in private_key.key -inform PEM -out private_key.der -outform DER
openssl x509 -in server_cert.crt -inform PEM -out server_cert.der -outform DER
Now, to make a keystore out of it:
java ImportKey private_key.der server_cert.der alias_priv_key
(This is a tool I found somewhere in the net, wich may be downloaded from ImportKey.java. No dependencies outside JDK.)
the output is:
Using keystore-file : /home/bartek/keystore.ImportKey
One certificate, no chain.
Key and certificate stored.
Alias: alias_priv_key Password:importkey
next step is to change the keystore's password with:
keytool -storepasswd -keystore keystore.ImportKey
give the 'importkey' password, then enter the new one twice and the job is done.
If the task is to add the key to already existing keystore with some other certs/keys - you need to merge them together (but luckily I don't need that :) ).
Brak komentarzy:
Prześlij komentarz