Skip to main content
IBM  
Shop Support Downloads
IBM Home Products Consulting Industries News About IBM
IBM developerWorks : Java : Education - Tutorials
Using JSSE for secure socket communication
ZIPPDF (letter)PDF (A4)e-mail
Main menuSection menuFeedbackPreviousNext
4. Key management
  


Working from the command line page 3 of 7


Below is a complete command that generates a public/private key pair and specifies all the required entity information without asking you any questions about your identity; that information is provided directly on the command line. The table that follows explains each option in the command.


keytool -genkey -alias clientprivate -keystore client.private
-storetype JKS -keyalg rsa -dname "CN=Your Name, OU=Your
Organizational Unit, O=Your Organization, L=Your City, S=Your State,
C=Your Country" -storepass clientpw -keypass clientpw
OptionWhat it means
-genkeyTells keytool to generate a key pair.
-alias clientprivateIdentifies the new key pair within the keystore.
-keystore client.privateUses the file client.private as the keystore.
-storetype JKSDeclares the type of the keystore. JKS is the default.
-keyalg rsaDeclares the algorithm to be used; we're using the RSA public key algorithm, which is the default.
-dname "CN=Your Name..."Provides information about the entity owning the key pair.
-storepass clientpwSpecifies the password for the entire keystore.
-keypass clientpwSpecifies the password for the new key pair.

Main menuSection menuFeedbackPreviousNext
Privacy Legal Contact