Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sign a JAR automatically when building from Netbeans

I want to know if Netbeans has some option or setting that will allow me to automatically sign a jar as part of the build.

like image 404
bguiz Avatar asked Mar 25 '10 22:03

bguiz


People also ask

How do I digitally sign a JAR file?

Digitally sign JARs with jarsignerCreate a JAR file with Java's JAR utility. Create public and private keys with Java's keytool. Export the server-side digital certificate with the keytool. Use the jarsigner tool to sign the JAR file digitally.

Why is JAR signing required?

In the case of signed JAR files, the certificate indicates who owns the public key contained in the JAR file. When you sign a JAR file your public key is placed inside the archive along with an associated certificate so that it's easily available for use by anyone wanting to verify your signature.


1 Answers

In your -post-jar ant target, it may be convenient to read the <signjar> password from a file, e.g. ~/.keyconf. Give the file user-only access: e.g. 400 or 600.

<loadfile srcfile="${user.home}/.keyconf" property="keyconf"/>
<signjar alias="..." storepass="${keyconf}">
    ...
</signjar>
like image 167
trashgod Avatar answered Oct 11 '22 02:10

trashgod