Menu

How to use sign4j?

Help
PhoneixS
2014-03-12
2014-03-12
  • PhoneixS

    PhoneixS - 2014-03-12

    Hello,

    I have an application in a Jar and I wrap it in a exe with launch4j so is easy for the user to launch it (in windows). I have a certificate, so I sign the jar (I don't know if this is really necessary because it will be wrapped inside the exe) and I want to sign the exe but it corrupt the executable.

    I use ant to make all the process and look like:

    <signjar jar="${jar.location}" alias="${key.alias}" storetype="pkcs12" keystore="${key.file}" storepass="${key.password}" tsaurl="https://timestamp.geotrust.com/tsa" />
    
    <launch4j configFile="launch4j_configuration.xml" fileversion="${version}.0" txtfileversion="${build}" productversion="${version}.0" txtproductversion="${build}" outfile="${exe.location}" jar="${jar.location}" />
    
    <signexe file="${exe.location}" alias="${key.alias}" storetype="pkcs12" keystore="${key.file}" storepass="${key.password}" tsaurl="http://timestamp.verisign.com/scripts/timstamp.dll" />
    

    I have seen inside the launch4j folder called sign4j that contains what I think is a program that solve this problem (this what I suppose reading the README file).

    My problem now is how is used this program? And how can I integrate it in the ant script to sign the exe?

     
  • PhoneixS

    PhoneixS - 2014-03-12

    What I have found for now is that you must execute the sign4j command with the signing command as its argument. Something like:

    sign4j jsign -s keyfile.p12 -a "(codesign_1091_es_sw_kpsc)" --storepass AVERYGOODPASSWORD --storetype pkcs12 -n MyProgram -u https://www.example.com MyProgram.exe
    
     
  • Grzegorz Kowal

    Grzegorz Kowal - 2014-03-12

    Hello,

    Exactly, this is the only way to sign the executable without corrupting it.
    There is no special ant task, but you can use exec to run sign4j.

    Grzegorz

     

Log in to post a comment.