The key tool is a Java development kit utility that allows you to manage a keystore (database) of private keys and their associated X.509 certificates. The keytool utility also manages certificates from trusted entities. This utility is located in <UnwiredPlatform_InstallDir>\UnwiredPlatform\Servers\SQLANywhere11\Sun\JRE160_x86\bin.
keytool -list | -printcert | -import | -export| -delete | -selfcert | -certreq | -genkey [options]
Option | Description |
---|---|
-keystore <keystoreLocation> | The name and location of the persistent keystore file for the keystore managed by keytool. If you specify, in the -keystore option, a keystore that does not exist, that keystore is created. If you do not specify a -keystore option, the default keystore is a file named .keystore in your home directory. If that file does not exist, it is created. |
-storepass <password> | The password that is used to protect the integrity of the keystore. The password must be at least 6 characters long. It must be provided to all commands that access the keystore contents. For such commands, if a -storepass option is not provided at the command line, the user is prompted for it. |
-file <certificateFile> | The certificate file location. |
-noprompt | During import, removes interaction with the user. |
-trustcacerts | When importing a certificate reply, the certificate reply is validated using trusted certificates from the keystore, and using the certificates configured in the cacerts keystore file. This file resides in the JDK security properties directory, java.home\lib\security, where java.home is the runtime environment's directory. The cacerts file represents a system-wide keystore with CA certificates. System administrators can configure and manage that file using keytool, specifying "jks" as the keystore type. |
-alias <alias> | The logical name for the certificate you are using. |
-keypass <password> | The password used to protect the private key of the key pair. If you press enter at the prompt, the key password is set to the same password as for the keystore. keypass must be at least 6 characters long. |
keytool -list -keystore <filePath>\keystore.jks -storepass <storepass>
keytool -import -file <certificate file> -keystore <filePath>\keystore.jks -storepass <storepass> -noprompt -trustcacerts -alias <alias>
keytool -delete -alias <alias> -keystore <filePath>\keystore.jks -storepass <storepass>
keytool -genkey -keystore <filePath>\keystore.jks
The certificate request must be signed by a CA. Alternatively, you can self-sign the certificate by using the -selfcert keytool option.