Generating A Certificate Using The Keytool Utility - Sun Microsystems GlassFish Enterprise Server 2.1 Administration Manual

Hide thumbs Also See for GlassFish Enterprise Server 2.1:
Table of Contents

Advertisement

Using Java Secure Socket Extension (JSSE) Tools

Generating a Certificate Using the keytool Utility

Use keytool to generate, import, and export certificates. By default, keytool creates a keystore
file in the directory where it is run.
1. Change to the directory where the certificate is to be run.
2. Enter the following keytool command to generate the certificate in the keystore file,
3. Enter the following keytool command to export the generated certificate to the file
4. If a certificate signed by a certificate authority is required, see
5. To create the truststore file cacerts.jks and add the certificate to the truststore, enter the
114
Sun GlassFish Enterprise Server 2.1 Administration Guide • December 2008
keytool -delete -noprompt -alias ${cert.alias} -keystore ${keystore.file}
-storepass ${keystore.pass}
Another example of deleting a certificate from a keystore is shown in
Using the keytool Utility" on page 115
Always generate the certificate in the directory containing the keystore and truststore files,
by default domain-dir/config. For information on changing the location of these files, see
"Changing the Location of Certificate Files" on page
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 certificate.
server.cer (or client.cer if you prefer):
keytool -export -alias keyAlias-storepass changeit
-file server.cer
-keystore keystore.jks
Using the keytool Utility" on page
following keytool command:
keytool -import -v -trustcacerts
-alias keyAlias
-file server.cer
-keystore cacerts.jks
-keypass changeit
112.
115.
"Deleting a Certificate
"Signing a Digital Certificate

Advertisement

Table of Contents
loading

Table of Contents