sslkeytoolibm-cloudsecure-gateway

How to import a secret key into key store by keytool


I would like to make my Liberty application to connect the Bluemix Secure Gateway'sdestination with TLS Mutual Auth. I tried to create a key store and import a cert and a secret key into the key store by keytool, but I don't know the keyalias of the secret key. I can't execute the command which imports the secret key into the key store. (The cert and the secret key were provided by Bluemix Secure Gateway's destination with TLS Mutual Auth(*))

*Bluemix Secure Gateway
https://www.ng.bluemix.net/docs/services/SecureGateway/index.html

Could you teach me how to know the keyalias of the secret key ? Or could you teach me any other way by keytool (not java code) to create keystore and import the secret key and cert but the following procedure ?

[the files provided by Bluemix Secure Gateway's destination]
destination_id_key.pem
destination_id_cert.pem

[procedure]

  1. create a key store and import the cert into the key store at once
    # keytool -import -file *destination_id*_cert.pem -keystore myKeyStore.jks -storepass password -alias mutual_cert

  2. import the secret key into the key store
    # keytool -importseckey -keyalias XXXXX -keystore myKeyStore.jks -storepass password -storetype jks -importfile *destination_id*_cert.pem

Solution

  • There is an example using openssl in the documentation to create a key store using the destination cert and key.

    https://www.ng.bluemix.net/docs/services/SecureGateway/sg_023.html#sg_007