aspose file tools*
The moose likes Java in General and the fly likes Sign a jar with a third party certificate, using keytool and jarsigner Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Sign a jar with a third party certificate, using keytool and jarsigner" Watch "Sign a jar with a third party certificate, using keytool and jarsigner" New topic
Author

Sign a jar with a third party certificate, using keytool and jarsigner

Sam Gehouse
Ranch Hand

Joined: Jul 21, 2003
Posts: 281
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.

jarsigner fails


I did a list to make sure that my keystore was created correctly, as shown below:



Any suggestion will be appreciated.

James Sabre
Ranch Hand

Joined: Sep 07, 2004
Posts: 781

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sign a jar with a third party certificate, using keytool and jarsigner