Java Code Signing: Download certificate & sign code
After verifying your certificate request, you can download your certificate files and use them to sign your Java code.
Download your certificate
- In your SSL certificate manager, click Download.
- Not in your SSL certificate manager? Log in to your HostingDude.com account.
- Click SSL Certificates.
- Next to the account you want to use, click Manage.
- Complete step 1 above.
- Click Download ZIP file.
Move your certificate file
- Unzip the
ZIP
file you download. - Open the unzipped folder and locate the file ending in
-SHA2.pem
. - (Optional) Rename the
PEM
file to something easier to type, for examplemycert.pem
. - Move the
PEM
file to the place where you created your keystore.
For Windows users, this is thebin
directory of your JDK installation—for example:
C:\Program Files\java\jdkversion number\bin
Windows-only preparation
If you're using Windows, you must complete the following steps before you can install the certificate and sign your code.
- Run
cmd
as an administrator. - Move to your JDK installation's
bin
directory:cd C:\Program Files\java\jdkversion number\bin
Install the certificate
- Through your command line, navigate to the directory where you created your keystore. (Windows users should already be here.)
- Install your certificate:
keytool -importcert -file mycert.pem -keystore codesignstore
- Enter your keystore's password.
- Type yes that you want to trust the certificate, and then press enter.
Sign your code
- Sign your code:
jarsigner -verbose -keystore codesignstore -tsa http://tsa.starfieldtech.com/ your jar file.jar codesigncert
Windows users might need to use the full paths to their keystore (JKS
) andJAR
files. - Enter your keystore's password.
- Verify your code is signed.
jarsigner -verify -verbose -certs your jar file.jar
If everything worked, you'll see jar verified.
You should expect to see "This jar contains entries whose certificate chain is not validated." The presence of this warning does not indicate that your certificate won't work.
Next step
- That's it! You can now start distributing your signed code.