File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes generate cert and self sign applet using ant script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "generate cert and self sign applet using ant script" Watch "generate cert and self sign applet using ant script" New topic
Author

generate cert and self sign applet using ant script

rajeev yadav
Greenhorn

Joined: Mar 28, 2011
Posts: 26
I am trying to self sign my applet using my ant script. I am using below code:

Target to generate certificate....
<target name="gencert" description="Generate a certificate to sign the jar file">
<genkey dname="cn=Rajeev, ou=My Name, o=Test, c=US" validity="3650" storepass="test" alias="test" keystore="test"/>
</target>

Code to sign jar:
<target="sometarget" depends="gencert">
<signjar storepass="test" alias="test" keystore="test">
<fileset dir="${build.applet.lib}" includes="*.jar"/>
</signjar>
</target>


This worked fine when I ran script for first time and signed my jars without any issues. When I ran the script it failed with below error:
gencert:
[genkey] Generating Key for test
[genkey] keytool error: java.lang.Exception: Key pair not generated, alias <test> already exists


From error message it is clear that it failed because key is already generated when I ran this first time so failing when i am trying again. Is there any way to check if certificate already exists than not to execute code inside gencert target.

Thanks,
Rajeev
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: generate cert and self sign applet using ant script
 
Similar Threads
How do I sign "jars" in the target directory using Maven?
Signing a JAR using a certificate
ANT & Jarsigner error: "not a private key"
Signed an applet
Self sign applets using ant build