How to sign Java applet
January 29, 2009 00:01:02 Last update: February 04, 2011 14:57:40
- Generate key valid for 10 years (3650 days). Since no
-keystoreoption is given, the key is stored in the default keystore$HOME/.keystore.C:\tmp>keytool -genkey -keyalg rsa -alias mykey -validity 3650 Enter keystore password: anything_is_fine_but_not_empty What is your first and last name? [Unknown]: First Last What is the name of your organizational unit? [Unknown]: Sales Dept. What is the name of your organization? [Unknown]: Big Store What is the name of your City or Locality? [Unknown]: New York What is the name of your State or Province? [Unknown]: NY What is the two-letter country code for this unit? [Unknown]: US Is CN=First Last, OU=Sales Dept., O=Big Store, L=New York, ST=NY, C=US correct? [no]: yes Enter key password for <mykey> (RETURN if same as keystore password):
- Create the applet jar:
jar -cf myapplet.jar com/my/applet
- Sign jar:
C:\tmp>jarsigner myapplet.jar mykey Enter Passphrase for keystore: whatever_was_entered_above
- Verify signature:
C:\tmp>jarsigner -verify -verbose -certs myapplet.jar