Current location - Quotes Website - Signature design - Java signature steps of digital signature
Java signature steps of digital signature
1. Package the applet's class file into *. Jar (if not, you can enter jar at the command line to view help).

First of all, we need to generate a keystore, otherwise we will get the following error when signing.

Jarsigner error: Java. lang. runtime exception: keystore loading: c:\ documents and settings \ ijee \ keystore (the system cannot find the specified file. (Here is my current system user name)

The statement that generates the keystore: keytool -genkey -alias alias. You can write it yourself-keyalrsa-keystore.keystore.

For example, mine is keytool-genkey-aliasijee-keyalg RSA-keystore.keystore.

Here are some steps of the digital signature that will appear:

Enter the keystore password:

Enter the new password again:

What's your first and last name?

[unknown ]:ijee

What is the name of your organizational unit?

[unknown ]: mtk

What is the name of your organization?

[unknown ]: mtk

What is the name of your city or region?

[Unknown]: Suzhou

What is the name of your state or province?

[Unknown]: Jiangsu

What is the two-letter country code of this unit?

[unknown]: cn

Is cn = ij2ee, ou = MTK, o = MTK, l = Suzhou, ST = Jiangsu and c = cn correct?

[no ]: y

enter

(If it is the same as the keystore password, press Enter):

At this time. The keystore will be generated in the bin directory of jdk. Move this. The keystore file to the c: \ documents and settings \ currentsystemuser directory.

3. Create a digital certificate

Enter the following command at the command line. PeakCA and peakCALib can be named by themselves. 3650 is a valid number of days, which is about 10 year. When creating a certificate, you need to fill in some information of the certificate and the private key password corresponding to the certificate. This information includes CN = XX, OU = XX, O = XX, L = XX, ST = XX, C = XX, all in Chinese, which can be understood at a glance.

keytool-genkey-alias peak ca-keyalg RSA-keysize 1024-keystore peak calib-validity 3650

4. Export the certificate to a certificate file.

Enter the following command at the command line. PeakCA and peakCALib can be named by themselves, and * * * * is the password you entered.

keytool-export-alias peak ca-file peak ca . cer-keystore peak calib-store pass * * * * * *-RFC

5. Authorize the jar file and enter the following instructions at the command line.

jarsigner-keystore peak calib my applet . jar peak ca