vendredi 15 septembre 2017

Use java jarsigner to self sign your java archive

Use jar signer to sign your java archive

Some applications or browsers security require that any jar you try to use must be signed. 
You can use java tool jarsigner to self sign your own jar files. 

First, you need to create your certificate or use your existing certificate. 

Create your own certificate

-    To create you own certificate, run the following command :

C:\Java\jdk1.8.0_92\bin\keytool.exe -genkeypair -alias ddy -keyalg rsa -keysize 2048 -keypass ddy1234 -validity 3650 -keystore C:\temp\mykeystore.jks -storepass ddy1234 -storetype jks -dname "CN=DDY,OU=OC,O=DDY,L=Paris,ST=IDF,C=FR" -v
Generating 2 048 bit RSA key pair and self-signed certificate (SHA256withRSA) wi
th a validity of 3 650 days
        for: CN=DDY, OU=OC, O=DDY, L=Paris, ST=IDF, C=FR
[Storing C:\temp\.keystore]


Use jarsigner 

- Use your certificate with jarsigner to sign your java archive : 

C:\Java\jdk1.8.0_92\bin\jarsigner -keystore C:\Temp\mykeystore.jks pdev.jar ddy 
Enter Passphrase for keystore: 
jar signed.



Aucun commentaire:

Enregistrer un commentaire