Import to JKS file
Java Signing:
Run the following command to apply the digital signature (Using JKS File):
- "C:\path\to\jarsigner.exe" -tsa http://timestamp.digicert.com -keystore "C:\path\to\your-keystore.jks" "C:\path\to\Your-Application.jar" alias
Run the following command to apply the digital signature (Using PFX File):
- "C:\path\to\jarsigner.exe" -tsa http://timestamp.digicert.com -storetype PKCS12 -keystore "C:\path\to\your-PFX.pfx" "C:\path\to\Your-Application.jar"
Run the following command to verify the digital signature:
- "C:\Path\to\jarsigner.exe" -verify -verbose -keystore "C:\Path\to\keystore.jks" "C:\Path\to\Your-Application.jar"
Creating the JKS if one doesn't exist
Run the following command to Create CSR and JKS file
- "C:\Program Files\Java\jdk-13.0.2\bin\keytool.exe" -genkey -alias server -keyalg RSA -keysize 2048 -keystore KEYSTORE-NAME.jks -dname "CN=ORGANIZATION NAME, O=ORGANIZATION NAME, L=CITY, ST=STATE, C=COUNTRY" && "C:\Program Files\Java\jdk-13.0.2\bin\keytool.exe" -certreq -alias server -file CSR-FILE-NAME.csr -keystore KEYSTORE-NAME.jks && echo Your certificate signing request is in CSR-FILE-NAME.csr. Your keystore file is KEYSTORE-NAME.jks
NOTE:
The alias is currently set to server. This can be changed if you wish, but all references of the alias will need to match the new alias.
Import certificate to JKS file
Run the following command to apply the digital signature:
- ""C:\Program Files\Java\jdk-13.0.2\bin\keytool.exe" -import -alias server -file YOUR-CERTIFICATE-FILE.p7b -keystore KEYSTORE-NAME.jks