In this example, using the default keystore of .keystore, we generate a self-signed certificate using the RSA algorithm with an alias of JoeUserKey and then view the created certificate. We will use this certificate in The concept of code signing to sign a JAR file.
D:\IBM>keytool -genkey -v -alias JoeUserKey -keyalg RSA
Enter keystore password: password
What is your first and last name?
[Unknown]: Joe User
What is the name of your organizational unit?
[Unknown]: Security
What is the name of your organization?
[Unknown]: Company, Inc.
What is the name of your City or Locality?
[Unknown]: User City
What is the name of your State or Province?
[Unknown]: MN
What is the two-letter country code for this unit?
[Unknown]: US
Is CN=Joe User, OU=Security, O="Company, Inc.", L=User City, ST=MN, C=US
correct?
[no]: y
Generating 1,024 bit RSA key pair and self-signed certificate (MD5WithRSA)
for: CN=Joe User, OU=Security, O="Company, Inc.", L=User City,
ST=MN, C=US
Enter key password for <JoeUserKey>
(RETURN if same as keystore password):
[Saving .keystore]
D:\IBM>keytool -list -v -alias JoeUserKey
Enter keystore password: password
Alias name: JoeUserKey
Creation date: Apr 15, 2002
Entry type: keyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=Joe User, OU=Security, O="Company, Inc.", L=User City, ST=MN,
C=US
Issuer: CN=Joe User, OU=Security, O="Company, Inc.", L=User City, ST=MN,
C=US
Serial number: 3cbae448
Valid from: Mon Apr 15 09:31:36 CDT 2002 until: Sun Jul 14 09:31:36
CDT 2002
Certificate fingerprints:
MD5: 35:F7:F7:A8:AC:54:82:CE:68:BF:6D:42:E8:22:21:39
SHA1: 34:09:D4:89:F7:4A:0B:8C:88:EF:B3:8A:59:F3:B9:65:AE:CE:7E:C9