.这个数据用实体私有钥匙签名并递交;
3.身份:知道实体的方法.在一些系统中身份是公共钥匙,其他系统中可以是从一个X.509名字的邮件地址的Unix UID来的任何东西;
4.签名:一个签名用用实体私有钥匙来计算某些加密数据;
5.私有钥匙:是一些数字,每一个私有钥匙只能被特定的拥有该私有钥匙的实体知道.私有和公共钥匙存在所有用公共钥匙加密的系统的钥匙对中.一个公共钥匙加密(如DSA),一个私有钥匙与一个正确的公共钥匙通信.私有钥匙用来计算签名.
6.实体:一个实体可以是一个人,一个组织,一个程序,一台计算机,一个商业,一个银行,或其他你想信任的东西.
Keytool应用实例:
1.产生一个keystore:
keytool -genkey -alias User(keystore的别名) -keyalg RSA -validity 7 -keystore keystore(指定keystore).
运行这个命令,系统提示:
Enter keystore password:yourpassword(输入密码)
What is your first and last name?
[Unknown]: your name(输入你的名字)
What is the name of your organizational unit?
[Unknown]:your organizational(输入你所在组织单位的名字)
What is the name of your organization?
[Unknown]:your organization name (输入你所在组织的名字)
What is the name of your City or Locality?
[Unknown]:your city name(输入所在城市的名字)
What is the name of your State or Province?
[Unknown]:your provice name(输入所在省份名字)
What is the two-letter country code for this unit?
[Unknown]:cn(输入国家名字)
Is CN=your name, ōU=your organizaion, O="your organization name",
L=your city name, ST=your province name, C=cn correct?
[no]: yes
Java keytool工具的作用及使用方法(3)
时间:2011-01-30
2.检查一个keystore:
keytool -list -v -keystore keystore
Enter keystore password:your password(输入密码)
将显示keystore內容如:
Keystore type: jks
Keystore provider: SUN
Your keystore contains 1 entry
Alias name: yourname
Creation date: Dec 20, 2001
Entry type: keyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=yourname, ōU=your organization, O="your organization name",
L=your city name, ST=your province name, C=CN
Issuer: CN=Duke, ōU=Java Software, O="Sun Microsystems, Inc.", L=Palo Alto, ST=CA, C=US
Serial number: 3c22adc1
Valid from: Thu Dec 20 19:34:25 PST 2001 until: Thu Dec 27 19:34:25 PST 2001
Certificate fingerprints:
MD5: F1:5B:9B:A1:F7:16:CF:25:CF:F4:FF:35:3F:4C:9C:F0
SHA1: B2:00:50:DD:B6:CC:35:66:21:45:0F:96:AA:AF:6A:3D:E4:03:7C:74
3.输出keystore到一个文件:testkey:
keytool -export -alias duke -keystore keystore -rfc -file testkey
系统输出:
Enter keystore password:your password(输入密码)
Certificate stored in file < td>
4.输入证书到一个新的truststore:
keytool -import -alias dukecert -file testkey -keystore truststore
Enter keystore password:your new password.(输入truststore新密码)
5.检查truststore:
keytool -list -v -keystore truststore
系统将显示truststore的信息.
现在可以用适当的keystore运行你的应用程序.如:
java -Djavax.net.ssl.keyStore=keystore -Djavax.net.ssl.keyStorePassword=password Server
和: java -Djavax.net.ssl.trustStore=truststore
-Djavax.net.ssl.trustStorePassword=trustword Client
|