Sign a jar with a third party certificate, using keytool and jarsigner
posted 5 years ago
I am trying to sign a jar file (e.g., my.jar) using a third party certificate (third.cer). I have placed "my.jar" and "third.cer" in the bin directory. I am getting an error while trying to sign the jar. It tells me that the keystore password is incorrect, which is not true. Any advice will be appreciated.
First, I successfully create a keystore and import the alias.
I did a list to make sure that my keystore was created correctly, as shown below:
You can't sign anything with a third party certificate. One signs using the private key associated with the public key held in the certificate. One checks a signature using the public key/certificate. If the private key were to be held in the public certificate the private key would not be private and therefore the signature would not prove anything and the signature would not be worth the paper it was written on!
The private key must be kept very very very private and only the owner should ever get access to it. If anyone else gets access to the private key then they can forge a signature.
Retired horse trader.
Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.