Sun Microsystems' keytool


Sun Microsystems provides a useful tool for understanding and even working with Certificates.
A description ofkeytool can be found at http://java.sun.com/products/jdk/1.2/docs/tooldocs/win32/keytool.html.

What follows is an actual keytool session with annotations.



/export/home/siegel/keytool%keytool -genkey -alias ec -keyalg RSA -validity 180 -keystore samplestore
Enter keystore password: weakpw
What is your first and last name?
  [Unknown]: Jerrold Siegel
What is the name of your organizational unit?
  [Unknown]: Information Technology Services
What is the name of your organization?
  [Unknown]: UM - St. Louis
What is the name of your City or Locality?
  [Unknown]: St. Louis
What is the name of your State or Province?
  [Unknown]: MO
What is the two-letter country code for this unit?
  [Unknown]: US
Is CN=Jerrold Siegel, OU=Information Technology Services, O=UM - St. Louis, L=St. Louis, ST=MO, C=US correct?
[no]: yes

Enter key password for <ec>
(RETURN if same as keystore password):

I have now generated a public-private key pair using RSA that will be valid for 180 days.


/export/home/siegel/keytool/keytool -list -v -keystore samplestore
Enter keystore password: weakpw

Keystore type: jks
Keystore provider: SUN

Your keystore contains 1 entry

Alias name: ec
Creation date: Dec 31, 2003
Entry type: keyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=Jerrold Siegel, OU=Information Technology Services, O=UM - St. Louis, L=St. Louis, ST=MO, C=US
Issuer: CN=Jerrold Siegel, OU=Information Technology Services, O=UM - St. Louis, L=St. Louis, ST=MO, C=US
Serial number: 3ff30166
Valid from: Wed Dec 31 11:03:34 CST 2003 until: Mon Jun 28 12:03:34 CDT 2004
Certificate fingerprints:
  MD5: C8:F5:97:82:95:FC:86:B0:A4:A1:47:29:CF:85:5C:88
  SHA1: BF:0F:ED:E4:93:6B:A4:9E:DB:2B:44:BC:92:C0:2B:64:EB:D3:92:3F


*******************************************
*******************************************


/export/home/siegel/keytool%keytool -certreq -keystore samplestore -alias ec -file ec.req
Enter keystore password: weakpw
/export/home/siegel/keytool%ls
./ ../ ec.req samplestore
/export/home/siegel/keytool%cat ec.req
-----BEGIN NEW CERTIFICATE REQUEST-----
MIIByzCCATQCAQAwgYoxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJNTzESMBAGA1UEBxMJU3QuIExv
dWlzMRcwFQYDVQQKEw5VTSAtIFN0LiBMb3VpczEoMCYGA1UECxMfSW5mb3JtYXRpb24gVGVjaG5v
bG9neSBTZXJ2aWNlczEXMBUGA1UEAxMOSmVycm9sZCBTaWVnZWwwgZ8wDQYJKoZIhvcNAQEBBQAD
gY0AMIGJAoGBAKgRBO7oLFh3okmThY7ENKyczfGpW6EaeRnwP0DIfUd/KmGPMAxOtCbSil46WkYF
RBxgQf3A8YAEXnlVePxbzOPOoXFyeR6rITpbG4mH12SEsLfpooLEHeOh2h/EUN9LdiiRy43BqJXV
1SwpInsGkGA1vusURqkT/l3Qf0fNbQCnAgMBAAGgADANBgkqhkiG9w0BAQQFAAOBgQAz5r2VkB4R
cKegASNxC5QePy3com8pd/HJfhjgHutqdhiCpWb2OovryF8woa1LgIG9XCQiFPsU1EwsRehSWAXj
s8n/Mobpd8CtQiUIcqSVOo/Wmnyxv++8MgY1SSjio6FxmnqpOfjDsiZQJJC7LszZE6HJaCytXE7B
p93XCGhEiw==
-----END NEW CERTIFICATE REQUEST-----
/export/home/siegel/keytool%