Sign Applet using code signing certificate and verify jar

UPDATED: 11 June 2014

An applet is Java program designed to be delivered over Internet/Network. The Java program executed automatically by Java compatible browser.

Code Signing Certificate
Like in real world we sign document, Code Signing Certificate does the same with code. Code signing certificate is used to preserve authenticity of code. You can buy code signing certificate through different vendor like verisign, Thawte, etc...

Note: I am using .jks (Java KeyStore) file to sign my applet. I haven't tried with other certificate as its not available for free. You can also contact your vendor for the same.

Step 1: Start command prompt.

Step 2: Execute below command by changing instructed values.
Note: I placed certificate and applet in same folder and pointing jarsigner.exe.
 * Change jarsigner.exe path 
 * Change certificate name and path
 * Change jar file name and path
cmd> "C:\Program Files\Java\jdk1.6.0_25\bin\jarsigner.exe" -keystore javaQueryThawte.jks applet.jar server

Step 3: Verifying jar you just signed.
 * Change jarsigner.exe path 
 * Change jar file name and path
cmd> "C:\Program Files\Java\jdk1.6.0_25\bin\jarsigner.exe" -verify -verbose -certs applet.jar

Lets say you required to sign same applet again and again, we'll act smart. Create executable batch file for windows system.
 * Open notepad
 * Change jarsigner.exe location
 * Change certificate name
 * Change jar file name
 * Save below code with file extension .bat i.e: signApplet.bat
@echo off
echo Applet Code Signing Console
"C:\Program Files\Java\jdk1.6.0_25\bin\jarsigner.exe" -keystore NextendersIndiaPvtLtd.jks POCDemo.jar server
"C:\Program Files\Java\jdk1.6.0_25\bin\jarsigner.exe" -verify -verbose -certs POCDemo.jar

Place signApplet.bat, certificate and jar file in same folder. Now execute signApplet.bat and provide password of certificate. You are done with it.