linux poison RSS
linux poison Email

How to create a self signed certificates for Java Applets

1. Create your code for the applet as usual.

2. Install JDK and set the class-path/path

3. Generate key: keytool -genkey -keyalg rsa -alias key

Enter keystore password:
What is your first and last name?
[Unknown]: Nikesh
What is the name of your organizational unit?
[Unknown]: Cybage
What is the name of your organization?
[Unknown]: Cybage
What is the name of your City or Locality?
[Unknown]: Pune
What is the name of your State or Province?
[Unknown]: MH
What is the two-letter country code for this unit?
[Unknown]: IN
Is CN=Nikesh, OU=Cybage, O=Cybage, L=Pune, ST=MH, C=IN correct?
[no]: yes

(wait...)

Enter key password for
(RETURN if same as keystore password):
Re-enter new password:

(press [enter])

4. Export key: keytool -export -alias key -file cert.crt

Enter keystore password: *******
Certificate stored in file cert.crt

5. Create JAR: jar cvf applet.jar main.class
Add all classes used in your project by typing the classnames in the same line.

added manifest
adding: main.class(in = 671) (out= 460)(deflated 31%)

6. Verify JAR: jar tvf applet.jar

0 Fri Jun 20 17:51:38 IST 2008 META-INF/
68 Fri Jun 20 17:51:38 IST 2008 META-INF/MANIFEST.MF
671 Wed Jun 18 11:48:34 IST 2008 main.class

7. Sign JAR: jarsigner applet.jar key
Enter Passphrase for keystore:******

Warning:
The signer certificate will expire within six months.

8. Verifiy Signing: jarsigner -verify -verbose -certs applet.jar


131 Fri Jun 20 17:53:04 IST 2008 META-INF/MANIFEST.MF
252 Fri Jun 20 17:53:04 IST 2008 META-INF/KEY.SF
889 Fri Jun 20 17:53:04 IST 2008 META-INF/KEY.RSA
0 Fri Jun 20 17:51:38 IST 2008 META-INF/
smk 671 Wed Jun 18 11:48:34 IST 2008 main.class

X.509, CN=Nikesh, OU=Cybage, O=Cybage, L=Pune, ST=MH, C=IN (key)
[certificate will expire on 9/18/08 5:47 PM]


s = signature was verified
m = entry is listed in manifest
k = at least one certificate was found in keystore
i = at least one certificate was found in identity scope

jar verified.

Warning:
This jar contains entries whose signer certificate will expire within six months.

9. Create HTML-File for use of the Applet


5 comments:

Post a Comment

Related Posts with Thumbnails