• Create all Classes and say they r in a directory named XYZ • Change to XYZ directory in command prompt• Now create a .jar file for the classes compiled
jar cvf (name of the jar file) (contents to be added to the jar)
jar cvf test.jar . ([DOT] means all the contents in the current directory will be considered )
Result : Now a new file named test.jar will be created in XYZ directory
• Now a keystore is to be generated so that the keys (cyptology) and the details of the certificate can be stored in it. We can do this with the help of keytool .keytool -genkey -alias (alias name for the keystore) –keypass (password to access private key stored in the keystore) -keystore (name of the keystore) -storepass (password to access the keystore)
keytool -genkey -alias testalias –keypass testkpass -keystore teststore -storepass testspass
-genkey - Generate Keys
-alias - Alias name for the key store
–keypass - Password to access the private key
-keystore - Name of the key store
-storepass - Password to access the keystore
The following details will be asked after executing the preceding statement. The details entered will be displayed in the digital certificate generated in further steps.
What is your first and last name? [Unknown]: Tez K N V
What is the name of your organizational unit? [Unknown]: Software Dev
What is the name of your organization? [Unknown]: SSS
What is the name of your City or Locality? [Unknown]: Hyderabad
What is the name of your State or Province? [Unknown]: AP
What is the two-letter country code for this unit? [Unknown]: IN
Is
correct? [no]: y
Result : A new keystore file will be generated with the name teststore in XYZ directory
• Next step is to sign the .jar file (test.jar) created.
This can be done with the help of jarsigner
jarsigner -keystore (name of the keystore) -signedjar (name of the signed jar file to be created) (name of the jar file created in the preceding steps)
jarsigner -keystore teststore -signedjar stest.jar test.jar signFiles
You will be prompted for the key store password (testspass) and the private key password (testkpass).
Result : A signed jar file with the name stest.jar will be created
• Now we are ready to Export the Public Key Certificate
keytool -export -keystore (name of the keystore) -alias (alias name of the keystore) -file (name of the digital certificate)
keytool -export -keystore teststore -alias testalias -file Certified.cer
You will be prompted for the store password (testspass).
Result : A publc key certificate will be created with the name Certified.cer
UR digital certificate is now ready in XYS directory with the name Certified.cer
tezcols
Labels: create digital certificate java swing applet