To Sign a JAR file using self signed Certificate follow below steps
keytool come with Java, so install Java First
Step1 : Create .jar file from .class file
C:\javaapp> jar cvf VideoANTyd.jar VideoANTyd.class
Step2 : Create a Key by using key tool
C:\javaapp>keytool -genkey -alias selfsigned -keyalg RSA -keysize 2048 -validity
360
Enter keystore password:
keytool error: java.io.IOException: Keystore was tampered with, or password was
incorrect
If you get above error goto C:/Users/yourname/ and delete .keystore file
Now again
C:\javaapp>keytool -genkey -alias selfsigned -keyalg RSA -keysize 2048 -validity
360
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: Name
What is the name of your organizational unit?
[Unknown]: VideoANT
What is the name of your organization?
[Unknown]: PMDOX
What is the name of your City or Locality?
[Unknown]: YourCity
What is the name of your State or Province?
[Unknown]: YourState
What is the two-letter country code for this unit?
[Unknown]: YourCountry
Is CN=Name, OU=VideoANT, O=PMDOX, L=YourCity, ST=YourState, C=YourCountry cor
rect?
[no]: yes
Enter key password for <selfsigned>
(RETURN if same as keystore password):
Step3 : Create certificate from Above Key
C:\javaapp>keytool -export -alias selfsigned -file VideoANT.crt
Enter keystore password:
Certificate stored in file <VideoANT.crt>
Step4 : Sign a JAR file
C:\javaapp>jarsigner VideoANTyd.jar selfsigned
Enter Passphrase for keystore:
C:\javaapp>
Success
keytool come with Java, so install Java First
Step1 : Create .jar file from .class file
C:\javaapp> jar cvf VideoANTyd.jar VideoANTyd.class
Step2 : Create a Key by using key tool
C:\javaapp>keytool -genkey -alias selfsigned -keyalg RSA -keysize 2048 -validity
360
Enter keystore password:
keytool error: java.io.IOException: Keystore was tampered with, or password was
incorrect
If you get above error goto C:/Users/yourname/ and delete .keystore file
Now again
C:\javaapp>keytool -genkey -alias selfsigned -keyalg RSA -keysize 2048 -validity
360
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: Name
What is the name of your organizational unit?
[Unknown]: VideoANT
What is the name of your organization?
[Unknown]: PMDOX
What is the name of your City or Locality?
[Unknown]: YourCity
What is the name of your State or Province?
[Unknown]: YourState
What is the two-letter country code for this unit?
[Unknown]: YourCountry
Is CN=Name, OU=VideoANT, O=PMDOX, L=YourCity, ST=YourState, C=YourCountry cor
rect?
[no]: yes
Enter key password for <selfsigned>
(RETURN if same as keystore password):
Step3 : Create certificate from Above Key
C:\javaapp>keytool -export -alias selfsigned -file VideoANT.crt
Enter keystore password:
Certificate stored in file <VideoANT.crt>
Step4 : Sign a JAR file
C:\javaapp>jarsigner VideoANTyd.jar selfsigned
Enter Passphrase for keystore:
C:\javaapp>
Success
0 comments:
Post a Comment