我的keytool

[root@localhost bin]# keytool -genkey -alias zljh  -keypass talent -keyalg RSA -keysize 1024 -validity 3650 -keystore /home/certificates/zljh.keystore -storepass talent
What is your first and last name?
  [Unknown]:  tong liu
What is the name of your organizational unit?
  [Unknown]:  zhonglijiahua
What is the name of your organization?
  [Unknown]:  hop
What is the name of your City or Locality?
  [Unknown]:  chengdu
What is the name of your State or Province?
  [Unknown]:  ^C[root@localhost bin]#
[root@localhost bin]# ^C
[root@localhost bin]#
[root@localhost bin]# keytool -genkey -alias zljh  -keypass talent -keyalg RSA -keysize 1024 -validity 3650 -keystore /home/certificates/zljh.keystore -storepass talent
What is your first and last name?
  [Unknown]:  Tong Liu
What is the name of your organizational unit?
  [Unknown]:  Zhonglijiahua
What is the name of your organization?
  [Unknown]:  Hop
What is the name of your City or Locality?
  [Unknown]:  Chengdu
What is the name of your State or Province?
  [Unknown]:  Sichuan
What is the two-letter country code for this unit?
  [Unknown]:  China
Is CN=Tong Liu, OU=Zhonglijiahua, O=Hop, L=Chengdu, ST=Sichuan, C=China correct?
  [no]:  y

keytool error: java.io.FileNotFoundException: /home/certificates/zljh.keystore (No such file or directory)
[root@localhost bin]# keytool -genkey -alias zljh  -keypass talent -keyalg RSA -keysize 1024 -validity 3650 -keystore /home/certificates/zljh.keystore -storepass talent
What is your first and last name?
  [Unknown]:  Tong Liu
What is the name of your organizational unit?
  [Unknown]:  Zhonglijiahua
What is the name of your organization?
  [Unknown]:  Hop
What is the name of your City or Locality?
  [Unknown]:  Chengdu
What is the name of your State or Province?
  [Unknown]:  Sichuan
What is the two-letter country code for this unit?
  [Unknown]:  China
Is CN=Tong Liu, OU=Zhonglijiahua, O=Hop, L=Chengdu, ST=Sichuan, C=China correct?
  [no]:  y

[root@localhost bin]# keytool -genkey -alias client1 -keypass 123456 -keyalg RSA -keysize 1024
Enter keystore password:  
Re-enter new password:
They don't match. Try again
Enter keystore password:  
Re-enter new password:
What is your first and last name?
  [Unknown]:  Jack Wan
What is the name of your organizational unit?
  [Unknown]:  development
What is the name of your organization?
  [Unknown]:  Oracle
What is the name of your City or Locality?
  [Unknown]:  Auckland
What is the name of your State or Province?
  [Unknown]:  Auckland
What is the two-letter country code for this unit?
  [Unknown]:  New Zealand
Is CN=Jack Wan, OU=development, O=Oracle, L=Auckland, ST=Auckland, C=New Zealand correct?
  [no]:  y

[root@localhost bin]# ls
ControlPanel  jarsigner       javah     jdb      jps         jvisualvm     rmic         tnameserv
appletviewer  java            javap     jhat     jrunscript  keytool       rmid         unpack200
apt           java-rmi.cgi    javaws    jinfo    jsadebugd   native2ascii  rmiregistry  wsgen
extcheck      javac           jcmd      jmap     jstack      orbd          schemagen    wsimport
idlj          javadoc         jconsole  jmc      jstat       pack200       serialver    xjc
jar           javafxpackager  jcontrol  jmc.ini  jstatd      policytool    servertool
[root@localhost bin]# keytool -genkey -alias client1 -keypass 123456 -keyalg RSA -keysize 1024  -validity 15 -storetype PKCS12 -keystore /home/certificates/client1.p12 -storepass 123456
What is your first and last name?
  [Unknown]:  Jack Wan
What is the name of your organizational unit?
  [Unknown]:  Development
What is the name of your organization?
  [Unknown]:  Oracle
What is the name of your City or Locality?
  [Unknown]:  Auckland
What is the name of your State or Province?
  [Unknown]:  Auckland
What is the two-letter country code for this unit?
  [Unknown]:  New Zealand
Is CN=Jack Wan, OU="Development ", O=Oracle, L=Auckland, ST=Auckland, C=New Zealand correct?
  [no]:  y

[root@localhost bin]# keytool -export -alias client -keystore /home/certificates/client1.p12 -storetype PKCS12 -keypass 123456 -file /home/certificates/client.cer
Enter keystore password:  
keytool error: java.lang.Exception: Alias <client> does not exist
[root@localhost bin]# keytool -export -alias client1 -keystore /home/certificates/client1.p12 -storetype PKCS12 -keypass 123456 -file /home/certificates/client1.cer
Enter keystore password:  
Certificate stored in file </home/certificates/client1.cer>
[root@localhost bin]# keytool  -import  -v  -file  /home/certificates/client.cer   -keystore  /home/certificates/zljh.keystore  -storepass  123456
keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect
java.io.IOException: Keystore was tampered with, or password was incorrect
    at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:772)
    at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:55)
    at java.security.KeyStore.load(KeyStore.java:1214)
    at sun.security.tools.KeyTool.doCommands(KeyTool.java:789)
    at sun.security.tools.KeyTool.run(KeyTool.java:340)
    at sun.security.tools.KeyTool.main(KeyTool.java:333)
Caused by: java.security.UnrecoverableKeyException: Password verification failed
    at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:770)
    ... 5 more
[root@localhost bin]# keytool  -import  -v  -file  /home/certificates/client.cer   -keystore  /home/certificates/zljh.keystore  -storepass  talent
keytool error: java.io.FileNotFoundException: /home/certificates/client.cer (No such file or directory)
java.io.FileNotFoundException: /home/certificates/client.cer (No such file or directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:146)
    at java.io.FileInputStream.<init>(FileInputStream.java:101)
    at sun.security.tools.KeyTool.doCommands(KeyTool.java:992)
    at sun.security.tools.KeyTool.run(KeyTool.java:340)
    at sun.security.tools.KeyTool.main(KeyTool.java:333)
[root@localhost bin]# keytool  -import  -v  -file  /home/certificates/client1.cer   -keystore  /home/certificates/zljh.keystore  -storepass  talent
Owner: CN=Jack Wan, OU="Development ", O=Oracle, L=Auckland, ST=Auckland, C=New Zealand
Issuer: CN=Jack Wan, OU="Development ", O=Oracle, L=Auckland, ST=Auckland, C=New Zealand
Serial number: 5421b6f7
Valid from: Wed Jan 03 07:12:32 EST 2018 until: Thu Jan 18 07:12:32 EST 2018
Certificate fingerprints:
     MD5:  54:7B:CD:F5:C0:A5:0E:81:F1:96:D6:B0:DA:B1:61:4C
     SHA1: 2C:1F:96:4E:6A:A3:22:10:E8:EB:10:AC:81:DD:97:5B:1E:0F:D1:A7
     SHA256: 97:4E:E9:2A:6D:6D:A3:BB:AF:07:A8:7C:EE:30:48:9D:94:73:1B:2F:6A:4E:DF:3B:64:D9:87:9F:22:C0:11:2D
     Signature algorithm name: SHA256withRSA
     Version: 3

Extensions:

#1: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 12 26 41 54 38 33 59 97   7E 50 EF F4 3E BC 2A C9  .&AT83Y..P..>.*.
0010: F1 FC 1B F8                                        ....
]
]

Trust this certificate? [no]:  y
Certificate was added to keystore
[Storing /home/certificates/zljh.keystore]
[root@localhost bin]# keytool  -list -v -keystore /home/certificates/zljh.keystore
Enter keystore password:  

Keystore type: JKS
Keystore provider: SUN

Your keystore contains 2 entries

Alias name: zljh
Creation date: Jan 3, 2018
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=Tong Liu, OU=Zhonglijiahua, O=Hop, L=Chengdu, ST=Sichuan, C=China
Issuer: CN=Tong Liu, OU=Zhonglijiahua, O=Hop, L=Chengdu, ST=Sichuan, C=China
Serial number: 5449b0df
Valid from: Wed Jan 03 07:06:09 EST 2018 until: Sat Jan 01 07:06:09 EST 2028
Certificate fingerprints:
     MD5:  7B:76:EF:81:9A:93:4B:84:97:50:ED:CA:96:79:AF:56
     SHA1: 72:3E:10:63:AA:72:52:AD:BC:3F:5B:DB:C2:F4:92:C1:F5:AC:39:84
     SHA256: D3:E6:8D:A2:02:EF:04:47:27:2F:FB:FF:EF:C8:E8:D2:33:30:BB:69:45:FB:C0:38:95:9A:EA:6C:11:CD:C7:20
     Signature algorithm name: SHA256withRSA
     Version: 3

Extensions:

#1: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: BC A7 B8 AA EE 66 BC 53   9F 28 82 71 B3 14 78 D1  .....f.S.(.q..x.
0010: 22 91 0D 95                                        "...
]
]



*******************************************
*******************************************


Alias name: mykey
Creation date: Jan 3, 2018
Entry type: trustedCertEntry

Owner: CN=Jack Wan, OU="Development ", O=Oracle, L=Auckland, ST=Auckland, C=New Zealand
Issuer: CN=Jack Wan, OU="Development ", O=Oracle, L=Auckland, ST=Auckland, C=New Zealand
Serial number: 5421b6f7
Valid from: Wed Jan 03 07:12:32 EST 2018 until: Thu Jan 18 07:12:32 EST 2018
Certificate fingerprints:
     MD5:  54:7B:CD:F5:C0:A5:0E:81:F1:96:D6:B0:DA:B1:61:4C
     SHA1: 2C:1F:96:4E:6A:A3:22:10:E8:EB:10:AC:81:DD:97:5B:1E:0F:D1:A7
     SHA256: 97:4E:E9:2A:6D:6D:A3:BB:AF:07:A8:7C:EE:30:48:9D:94:73:1B:2F:6A:4E:DF:3B:64:D9:87:9F:22:C0:11:2D
     Signature algorithm name: SHA256withRSA
     Version: 3

Extensions:

#1: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 12 26 41 54 38 33 59 97   7E 50 EF F4 3E BC 2A C9  .&AT83Y..P..>.*.
0010: F1 FC 1B F8                                        ....
]
]



*******************************************
*******************************************


[root@localhost bin]# keytool -keystore  /home/certificates/zljh.keystore  -export -alias tomcat6 -file /home/certificates/client1.cer
Enter keystore password:  [root@localhost bin]# ^C
[root@localhost bin]# keytool -keystore  /home/certificates/zljh.keystore  -export -alias  jack   -file /home/certificates/client1.cer
Enter keystore password:  
keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect
[root@localhost bin]# keytool -keystore  /home/certificates/zljh.keystore  -export -alias  jack   -file /home/certificates/client1.cer
Enter keystore password:  
keytool error: java.lang.Exception: Alias <jack> does not exist
[root@localhost bin]# keytool -keystore  /home/certificates/zljh.keystore  -export -alias client1   -file /home/certificates/client1.cer
Enter keystore password:  
keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect
[root@localhost bin]# keytool -keystore  /home/certificates/zljh.keystore  -export -alias client1   -file /home/certificates/client1.cer
Enter keystore password:  
keytool error: java.lang.Exception: Alias <client1> does not exist
[root@localhost bin]# keytool -keystore  /home/certificates/zljh.keystore  -export -alias zljh   -file /home/certificates/client1.cer
Enter keystore password:  
Certificate stored in file </home/certificates/client1.cer>
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值