Creating a New Key Pair and Self-Signed Certificate Using keytool
This example uses the keytool program to create a new key pair and
self-signed certificate for the principal Duke. The example
generates a 1024-bit Digital Signature Algorithm (DSA) key pair.
To create a 1024-bit RSA key:
> keytool -genkey -alias alias -keystore .keystore
Enter keystore password: password
What is your first and last name?
[Unknown]: Duke
What is the name of your organizational unit?
[Unknown]: JavaSoft
What is the name of your organization?
[Unknown]: Sun
What is the name of your City or Locality?
[Unknown]: Cupertino
What is the name of your State or Province?
[Unknown]: CA
What is the two-letter country code for this unit?
[Unknown]: US
Is <CN=Duke, OU=JavaSoft, O=Sun, L=Cupertino, ST=CA, C=US> correct?
[no]: yes
> keytool -genkey -keyalg RSA -keysize 1024 -alias alias -keystore .keystore
Post a comment