Sun Microsystems 820433510 Server User Manual


 
keytool -delete -noprompt -alias ${cert.alias} -keystore ${keystore.file}
-storepass ${keystore.pass}
Another example of deleting a certicate from a keystore is shown in “Deleting a Certicate
Using the keytool Utility” on page 115
Generating a Certicate Using the keytool Utility
Use keytool to generate, import, and export certicates. By default, keytool creates a keystore
le in the directory where it is run.
1. Change to the directory where the certicate is to be run.
Always generate the certicate in the directory containing the keystore and truststore les,
by default domain-dir/config. For information on changing the location of these les, see
“Changing the Location of Certicate Files” on page 112.
2. Enter the following keytool command to generate the certicate in the keystore le,
keystore.jks:
keytool -genkey -alias keyAlias-keyalg RSA
-keypass changeit
-storepass changeit
-keystore keystore.jks
Use any unique name as your keyAlias. If you have changed the keystore or private key
password from their default, then substitute the new password for changeit in the above
command. The default key password alias is “s1as.”
A prompt appears that asks for your name, organization, and other information that
keytool uses to generate the certicate.
3. Enter the following keytool command to export the generated certicate to the le
server.cer (or client.cer if you prefer):
keytool -export -alias keyAlias-storepass changeit
-file server.cer
-keystore keystore.jks
4. If a certicate signed by a certicate authority is required, see “Signing a Digital Certicate
Using the keytool Utility” on page 115
.
5. To create the truststore le cacerts.jks and add the certicate to the truststore, enter the
following keytool command:
keytool -import -v -trustcacerts
-alias keyAlias
-file server.cer
-keystore cacerts.jks
-keypass changeit
UsingJavaSecure SocketExtension(JSSE)Tools
SunGlassFishEnterpriseServer2.1AdministrationGuide • December2008114