Create a keystore for SOAPUI from a .p7b file

I had to use SOAPUI to send some requests to a SOAP API at work the other day, and the API in question required the use of a certificate. I had the required certificate in a .p7b file, as well as the private key in a .key file, but those can’t be used directly with SOAPUI. I had to create a keystore and populate that keystore with my certificate (and private key). Unfamiliar with certificates that I was (and still am), I tried a bunch of different things suggested by the top google-results for queries such as “create keystore from p7b”. What finally worked was this recipe. Here are the steps:

  1. Convert the .p7b file to a .pem file: openssl pkcs7 -print_certs -in file.p7b -out file.pem

  2. Export the .pem file with the private key to a .p12 file: openssl pkcs12 -export -name aliasName -in file.pem -inkey file.key -out file.p12
    Here file.key is the private key.

  3. Import the .p12 file to a new keystore: keytool -importkeystore -srcstoretype pkcs12 -srckeystore file.p12 -destkeystore file.jks

The result of these three commands in that I have a keystore in the file file.jks that can be used with SOAPUI:

Screenshot of SoapUI settings showing how to set the keystore

The password is the password you entered when running the keytool -importkeystore-command above.

Comments

comments powered by Disqus