This section describes keytool commands used to manage a keystore, and assumes that your keystore is located in m:\target1.4\Repository\Security\keystore.jks:
To see what is contained in the keystore:
keytool -list -keystore m:\target1.4\Repository\Security\keystore.jks -storepass <storepass>
<storepass> is the keystore’s password.
To import a certificate:
keytool -import -file <certificate file> -keystore m:\target1.4\Repository\Security\keystore.jks -storepass <storepass> -noprompt -trustcacerts -alias <alias>
<alias> is the logical name for the certificate stored in the keystore.
To delete a certificate:
keytool -delete -alias <alias> -keystore m:\target1.4\Repository\Security\keystore.jks -storepass <storepass>
<alias> is the logical name for the certificate you want to delete.
To create a new keyentry in a keystore:
keytool -genkey -keystore m:\target1.4\Repository\Security\keystore.jks
The certificate request must be signed by a CA. Alternatively, you can self-sign the certificate by using the -selfcert keytool option.
keytool can read/manipulate
PKCS12 type keystores (specify a
-storetype pkcs12 in the command line), but cannot import
it into another jks type keystore. jks is the default keystore type
for keytool commands.