Prepare the following five batch files:
Set. cmd
Set JDK_BIN = E: "Program Files" Javajdk1.6.0 _ 24in
Set KEY_FOLDER = E: DigitalSignature
Key. cmd
Call set. cmd
% JDK_BIN % keytool-genkey-keystore % KEY_FOLDER % cuckoo. keystore-alias cuckoo <KEY_ANSWER.lst
% JDK_BIN % keytool-selfcert-keystore % KEY_FOLDER % cuckoo. keystore-alias cuckoo-validity 1000 <KEY_PWD.lst
% JDK_BIN % keytool-export-keystore % KEY_FOLDER % cuckoo. keystore-alias cuckoo-file % KEY_FOLDER % cuckoo. cer <KEY_PWD.lst
Note: KEY_ANSWER.lst and KEY_PWD.lst are the input redirection files. read each line from the text file to answer the command line question. Press the newline and press enter to submit. -Validity is followed by the signature validity period, in days. The default value is half a year.
Example: KEY_ANSWER.lst
Password
Password
Ren Jian
The CUCKOO Workgroup
Sun Yat-sen University
Guangzhou
Guangdong
CN
Yes
(Add two lines to the end)
KEY_PWD.lst
Password
(Line feed)
Selfsign. cmd
% JDK_BIN % jarsigner-keystore % KEY_FOLDER % cuckoo. keystore % 1 cuckoo <KEY_PWD.lst
Sign. cmd
Call set. cmd
Call selfsign. cmd % 1
Batchsign. cmd
Call set. cmd
For % N in (% 1 *. jar) do call selfsign. cmd % N
Instructions for use:
1. set the JDK_BIN folder location and the folder location where the Key is stored in set. cmd.
2. Run key. cmd to generate a key
3. Single file Signature
Command: sign. cmd [jar]
4. Batch sign all files in the specified folder:
Command: batchsign. cmd [jar_folder]