Java digital signature (digital signature) Batch File Creation
Prepare the following five batch files:
Set. cmd
Set jdk_bin = E:/"Program Files"/Java/jdk1.6.0 _ 24/bin
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
In order to enter the redirection file, read each line from the text file to answer the command line question, and press ENTER for submission.
-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]