generate cert and self sign applet using ant script
posted 6 years ago
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"/>
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:
[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.