

To be sure though, you should test that the public key is now in your keystore file.

#USE .PKS FOR JAVA KEYSTORE EXPLORER PASSWORD#
The password shown above is the password for the keystore named publicKey.store.Īt this point, assuming everything worked, you probably don't need the intermediate certificate file, so you can delete it.The alias used here (publicCertFromAl) does not have to correspond to the alias used when the private key keystore and certificate file were created.Issuer: CN=Alvin Alexander, OU=Application Development, O=, L=Louisville, ST=KY, C=US Owner: CN=Alvin Alexander, OU=Application Development, O=, L=Louisville, ST=KY, C=US $ keytool -import -alias publicCertFromAl -file certfile.cer -keystore publicKey.store Hopefully you can use the description I just provided to understand how this command works: Here's the actual input and output from a Java keytool import example. Note: The file publicKey.store may already exist, in which case the public key for "foo" will be added to that keystore file otherwise, publicKey.store will be created.If you find the alias "foo", import the information into the keystore named "publicKey.store".Look in that file for an alias named "foo".Read from the certfile file named certfile.cer.$ keytool -import -alias foo -file certfile.cer -keystore publicKey.store Java keytool import - Import a certificate into a public keystoreĪssuming that you've been given a certificate file named "certfile.cer" which contains an alias named "foo", you can import it into a public keystore named "publicKey.store" with the following keytool import command: In this example I'll assume that you have just received a keytool certificate file from another person, and you want to import the information in that certificate file into your public keystore file. To do this you need to use the Java keytool import command. Import it into your public key keystore, and then you can do XYZ", where "XYZ" can be a variety of things, including reading their document, using their Java application, etc. When you're working with Java public and private keys, there may be a time when someone else says, "Here is a certificate. Java “keytool import” FAQ: Can you share some examples of the Java keytool import command and process?
