Link to home
Start Free TrialLog in
Avatar of ellandrd
ellandrdFlag for Ireland

asked on

never expire signed jar

how can i create a self-certify jar/applet so that it never expires
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ellandrd

ASKER

Hi CEHJ - i finally got my boss to use java as solution to our NT username issue after we tired everything else 'we' could think of and failed each time...

im not too sure how how edit my build.xml file and add these extra params in... maybe some help please?
so far i have this:

<target name="package" depends="build" description="--&gt; create distribution">
        <jar destfile="LDAPConnector.jar" basedir="${project.build}" update="false">
            <manifest>
                <attribute name="Built-By" value="Sean Delaney"/>
                <attribute name="Main-Class" value="${project.main.class}"/>
                <attribute name="Specification-Title" value="${ant.project.name}"/>
            </manifest>
        </jar>
        <antcall target="sign-jar">
        </antcall>
    </target>

    <target name="sign-jar">
        <!-- check if a keystore file is required -->
        <condition property="keystore.missing">
            <not>
                <available file="${basedir}/etc/SeanDelaneyStore">
                </available>
            </not>
        </condition>
        <antcall target="generate-keystore">
        </antcall>
        <signjar jar="LDAPConnector.jar" keystore="${basedir}/etc/SeanDelaneyStore" alias="SeanDelaneySign" signedjar="sLDAPConnector.jar" storepass="xxx" keypass="xxx" verbose="true">
        </signjar>
    </target>

    <target name="generate-keystore" if="keystore.missing">
        <echo>***** Generating a new keystore file. *****</echo>
        <genkey alias="SeanDelaneySign" storepass="xxx" verbose="true" keystore="${basedir}/etc/SeanDelaneyStore" keypass="xxx" dname="CN=Sean Delaney, OU=Sean Delaney, O=User, C=Pegasus International">
        </genkey>
    </target>

not too sure where ot add these extra bits.  
Make that

<genkey validity="18250" alias="SeanDelaneySign" storepass="xxx" verbose="true" keystore="${basedir}/etc/SeanDelaneyStore" keypass="xxx" dname="CN=Sean Delaney, OU=Sean Delaney, O=User, C=Pegasus International">
        </genkey>
Mmm i though you said use self cert?

so i had:

<selfcert validity="18250" alias="SeanDelaneySign" storepass="xxx" verbose="true" keystore="${basedir}/etc/SeanDelaneyStore" keypass="xxx" dname="CN=Sean Delaney, OU=Sean Delaney, O=User, C=Pegasus International">
        </selfcert>


does it matter?
when i package my application is still get a message saying this

Warning: The signer certificate will expire within six months.

im using netbeans...
>>Mmm i though you said use self cert?

Well, since you have genkey and it has a 'validity' attribute, you may as well use it

>>im using netbeans...

Make sure it's not ignoring build.xml and that genkey is running
ive created my own ANT file to create the package so it isnt using the default build.xml.

im assume it is running OK, it creates my signed JAR's etc fine, but it keeps saying expires in 6 mnths..

when i select to trust it on my machines and check to see what the validity is set at, they all all set to toexpire in Aug 27 2006.... so i need to get this never expire thingy working...

i have tired both <selfcert ..></selfcert> and <keygen ...></keygen> and both say the same...
Are you sure the target 'generate-keystore' is running?
i will print out the output from my package...and show you
build:
package:
Building jar: C:\Pegasus\JavaApplication14\LDAPConnector.jar
sign-jar:
generate-keystore:
Signing JAR: C:\Pegasus\JavaApplication14\LDAPConnector.jar
 updating: META-INF/MANIFEST.MF
   adding: META-INF/SEANDELA.SF
   adding: META-INF/SEANDELA.DSA
   adding: org/
  signing: org/LDAPConnector.class

Warning: The signer certificate will expire within six months.
BUILD SUCCESSFUL (total time: 1 second)
Can you run ant with

-v

and see what it says
OK

i only know how to run ANt from creating a mybuild.xml file and setting my targets etc.

i have never used it by command linea nd the version of ANT i have came by default with netbeans 5.
You need to find out how to use Ant fully within Netbeans then or ingore Netbeans and run it from the command line
OK... i will close this question accepting your first comment and try to get ANT working...

if i still have problems, i'll just open another question and maybe you can see what im doing wrong...

thanks BTW

:-)