#!/bin/tcsh # Script to renew signature in jars # 1- Put all the jars in a directory # 2- Put the certificate (in this case java-keystore-2020.jks) and this Script in the same directory # 3- Create 2 subdirectories: jarClasses and signedjars # 4- Execute with ./signerScript # 5- Jars with new signature will be placed under signedjars foreach i (*.jar) echo $i cp $i ./jarClasses/ cd ./jarClasses/ echo extracting $i jar xvf $i cd META-INF echo removing signatures rm -rf *.DSA *.SF *.RSA echo create new manifest without signatures grep "\S" MANIFEST.MF | grep -v "SHA1-Digest:"| grep -v "SHA-256-Digest:" | grep -v "Name:" > NEW_MANIFEST.MF echo moving to new created manifest to new mv NEW_MANIFEST.MF MANIFEST.MF cd .. rm $i echo create new jar jar cvfM $i * echo sign new jar #jarsigner -tsa http://timestamp.digicert.com -keystore ../java-keystore-2020.jks -storepass javaMachine $i sat #echo move signed jar to signedjars directory #cp $i ../signedjars/ #rm -rf * #cd .. #echo $i signed #end