[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

never expire signed jar

Posted on 2006-05-29
16
Medium Priority
?
3,147 Views
Last Modified: 2009-07-29
how can i create a self-certify jar/applet so that it never expires
0
Comment
Question by:ellandrd
  • 9
  • 7
16 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 2000 total points
ID: 16784194
Create a certificate using keytool


http://java.sun.com/j2se/1.4.2/docs/tooldocs/tools.html

use

-selfcert

and set

-validity 18250

which should give you 50 years
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16784440
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?
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16784510
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.  
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 86

Expert Comment

by:CEHJ
ID: 16784594
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>
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16784709
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?
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16784771
when i package my application is still get a message saying this

Warning: The signer certificate will expire within six months.

im using netbeans...
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16784793
>>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
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16784850
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...
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16784898
Are you sure the target 'generate-keystore' is running?
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16784907
i will print out the output from my package...and show you
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16784915
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)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16784926
Can you run ant with

-v

and see what it says
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16784951
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.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16784963
You need to find out how to use Ant fully within Netbeans then or ingore Netbeans and run it from the command line
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16785030
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

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16785050
:-)

0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses
Course of the Month20 days, 14 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question