Create Server Keystore
A server keystore is used to store the server's private certificate.
Required inputs
- server alias (for example, "myserver")
- key algorithm (for example, "RSA")
- key store filename (for example, "keystore_server")
- key store password (for example, "secretPassword")
- distinguished name to be associated with the certificate
(for example, CN=myserver,OU="my site",O="Acme, Inc.",L="Cary",ST="NC",C="US")
Procedure
- Open a command window
- Ensure that the command window contains the JRE\bin directory in its path
set path=%path%;C:\j2sdk1.4.2_02\bin
- Navigate the command window to a private directory which will contain the server's keystore file
(for example, C:\TomCat\webapps\MyWebApp\private\)
- Create a server keystore which will have a private key associated with it.
- keytool -genkey -alias <server_alias> -keyalg <key_algorithm> -keystore <keystore_filename>
(for example, keytool -genkey -alias myserver -keyalg RSA -keystore keystore_server )
- Enter keystore password: secretPassword <Return>
- What is your first and last name?
[Unknown]: myserver <Return>
- What is the name of your organizational unit?
[Unknown]: my site <Return>
- What is the name of your organization?
[Unknown]: Acme, Inc. <Return>
- What is the name of your City or Locality?
[Unknown]: Cary <Return>
- What is the name of your State or Province?
[Unknown]: NC <Return>
- What is the two-letter country code for this unit?
[Unknown]: US <Return>
- Is CN=myserver, OU="my site", O="Acme, Inc.", L=Cary, ST=NC, C=US correct?
[no]: yes <Return>
- Enter key password for <myserver>
(RETURN if same as keystore password): <Return>
- Verify creation of the server's keystore file keystore_server.
- The server's public
certificate can now be exported from the keystore.