Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Self sign applets using ant build

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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
 
Every time you till, you lose 30% of your organic matter. But this tiny ad is durable:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic