@wuxin1994
2019-06-04T09:38:27.000000Z
字数 12052
阅读 1262
JAVA
https://blog.csdn.net/johntsu2006/article/details/80723726
关于https:
https://blog.csdn.net/ly131420/article/details/38400583
D:\OpenSSL-Win64\bin>dir驱动器 D 中的卷是 App卷的序列号是 C67B-0BC3D:\OpenSSL-Win64\bin 的目录2019/06/04 15:08 <DIR> .2019/06/04 15:08 <DIR> ..2019/05/28 22:36 7,813 CA.pl2019/05/28 22:36 69,120 capi.dll2019/05/28 22:36 44,544 dasync.dll2019/06/04 15:08 2,527 keystore.p122019/05/28 22:36 3,407,360 libcrypto-1_1-x64.dll2019/05/28 22:36 681,472 libssl-1_1-x64.dll2019/05/28 22:36 542,720 openssl.exe2019/05/28 22:36 44,032 ossltest.dll2019/05/28 22:36 39,936 padlock.dll2019/05/31 16:01 <DIR> PEM2019/05/28 22:36 5,562 progs.pl2019/05/28 22:36 6,779 tsget.pl11 个文件 4,851,865 字节3 个目录 379,711,356,928 可用字节D:\OpenSSL-Win64\bin>dir驱动器 D 中的卷是 App卷的序列号是 C67B-0BC3D:\OpenSSL-Win64\bin 的目录2019/06/04 15:15 <DIR> .2019/06/04 15:15 <DIR> ..2019/05/28 22:36 7,813 CA.pl2019/05/28 22:36 69,120 capi.dll2019/05/28 22:36 44,544 dasync.dll2019/05/28 22:36 3,407,360 libcrypto-1_1-x64.dll2019/05/28 22:36 681,472 libssl-1_1-x64.dll2019/05/28 22:36 542,720 openssl.exe2019/05/28 22:36 44,032 ossltest.dll2019/05/28 22:36 39,936 padlock.dll2019/05/31 16:01 <DIR> PEM2019/05/28 22:36 5,562 progs.pl2019/05/28 22:36 6,779 tsget.pl10 个文件 4,849,338 字节3 个目录 379,711,348,736 可用字节D:\OpenSSL-Win64\bin>openssl genrsa -out server.pemGenerating RSA private key, 2048 bit long modulus (2 primes)...+++++................................................+++++e is 65537 (0x010001)D:\OpenSSL-Win64\bin>openssl req -x509 -new -key server.pem -out server.crtYou are about to be asked to enter information that will be incorporatedinto your certificate request.What you are about to enter is what is called a Distinguished Name or a DN.There are quite a few fields but you can leave some blankFor some fields there will be a default value,If you enter '.', the field will be left blank.-----Country Name (2 letter code) [AU]:CNState or Province Name (full name) [Some-State]:beijingLocality Name (eg, city) []:beijingOrganization Name (eg, company) [Internet Widgits Pty Ltd]:MyServerOrganizational Unit Name (eg, section) []:MySeverCommon Name (e.g. server FQDN or YOUR name) []:www.baidu.comEmail Address []:D:\OpenSSL-Win64\bin>openssl genrsa -out htx-server.pemGenerating RSA private key, 2048 bit long modulus (2 primes)...................................................+++++........+++++e is 65537 (0x010001)D:\OpenSSL-Win64\bin>openssl req -new -key htx-server.pem -out htx-server.csrYou are about to be asked to enter information that will be incorporatedinto your certificate request.What you are about to enter is what is called a Distinguished Name or a DN.There are quite a few fields but you can leave some blankFor some fields there will be a default value,If you enter '.', the field will be left blank.-----Country Name (2 letter code) [AU]:CNState or Province Name (full name) [Some-State]:beijingLocality Name (eg, city) []:beijingOrganization Name (eg, company) [Internet Widgits Pty Ltd]:MySever2Organizational Unit Name (eg, section) []:Mysever2Common Name (e.g. server FQDN or YOUR name) []:www.baidu.comEmail Address []:Please enter the following 'extra' attributesto be sent with your certificate requestA challenge password []:An optional company name []:D:\OpenSSL-Win64\bin>openssl x509 -req -in htx-server.csr -CA server.crt -CAkey server.pem -CAcreateserial -days 3650 -out htx-server.crtSignature oksubject=C = CN, ST = beijing, L = beijing, O = MySever2, OU = Mysever2, CN = www.baidu.comGetting CA Private KeyD:\OpenSSL-Win64\bin>keytool -importkeystore -srckeystore htx-server.p12 -destkeystore htx-server.jks -srcstoretype pkcs12正在将密钥库 htx-server.p12 导入到 htx-server.jks...输入目标密钥库口令:再次输入新口令:它们不匹配。请重试输入目标密钥库口令:再次输入新口令:输入源密钥库口令:已成功导入别名 1 的条目。已完成导入命令: 1 个条目成功导入, 0 个条目失败或取消Warning:JKS 密钥库使用专用格式。建议使用 "keytool -importkeystore -srckeystore htx-server.jks -destkeystore htx-server.jks -deststoretype pkcs12" 迁移到行业标准格式 PKCS12。D:\OpenSSL-Win64\bin>keytool -importcert -keystore htx-server.jks -file server.crt输入密钥库口令:所有者: CN=www.baidu.com, OU=MySever, O=MyServer, L=beijing, ST=beijing, C=CN发布者: CN=www.baidu.com, OU=MySever, O=MyServer, L=beijing, ST=beijing, C=CN序列号: 2086ab43ad3a294d722f1b14a0e4a3fa704e5087有效期为 Tue Jun 04 15:33:51 CST 2019 至 Thu Jul 04 15:33:51 CST 2019证书指纹:MD5: 94:3D:FB:DF:15:27:63:7F:3B:8F:A9:78:A8:A0:48:C0SHA1: 67:9D:FC:69:BB:E1:C9:F9:B2:DC:C8:3C:10:73:1C:EF:F0:DE:8C:71SHA256: 5F:FB:EC:AE:C0:32:85:BF:3B:39:62:63:BB:F7:26:06:AA:37:67:B8:C9:9F:05:CD:67:23:B2:E0:B6:96:1C:FE签名算法名称: SHA256withRSA主体公共密钥算法: 2048 位 RSA 密钥版本: 3扩展:#1: ObjectId: 2.5.29.35 Criticality=falseAuthorityKeyIdentifier [KeyIdentifier [0000: 2A BC AE CE DB E9 7A F2 56 FC 1A B2 8D 22 AF 9D *.....z.V...."..0010: B5 04 47 CB ..G.]]#2: ObjectId: 2.5.29.19 Criticality=trueBasicConstraints:[CA:truePathLen:2147483647]#3: ObjectId: 2.5.29.14 Criticality=falseSubjectKeyIdentifier [KeyIdentifier [0000: 2A BC AE CE DB E9 7A F2 56 FC 1A B2 8D 22 AF 9D *.....z.V...."..0010: B5 04 47 CB ..G.]]是否信任此证书? [否]: y证书已添加到密钥库中Warning:JKS 密钥库使用专用格式。建议使用 "keytool -importkeystore -srckeystore htx-server.jks -destkeystore htx-server.jks -deststoretype pkcs12" 迁移到行业标准格式 PKCS12。D:\OpenSSL-Win64\bin>
https://blog.csdn.net/johntsu2006/article/details/80723726
D:\OpenSSL-Win64\bin>openssl genrsa -out server.key 2048 ZGenerating RSA private key, 2048 bit long modulus (2 primes).........................................+++++......+++++e is 65537 (0x010001)D:\OpenSSL-Win64\bin>openssl rsa -in server.key -pubout -out server.pemwriting RSA keyD:\OpenSSL-Win64\bin>openssl genrsa -out client.key 2048Generating RSA private key, 2048 bit long modulus (2 primes)................................................................+++++.+++++e is 65537 (0x010001)D:\OpenSSL-Win64\bin>openssl rsa -in client.key -pubout -out client.pemwriting RSA keyD:\OpenSSL-Win64\bin>openssl genrsa -out ca.key 2048Generating RSA private key, 2048 bit long modulus (2 primes)......+++++...............................+++++e is 65537 (0x010001)D:\OpenSSL-Win64\bin>openssl req -new -key ca.key -out ca.csrYou are about to be asked to enter information that will be incorporatedinto your certificate request.What you are about to enter is what is called a Distinguished Name or a DN.There are quite a few fields but you can leave some blankFor some fields there will be a default value,If you enter '.', the field will be left blank.-----Country Name (2 letter code) [AU]:CNState or Province Name (full name) [Some-State]:beijingLocality Name (eg, city) []:beijingOrganization Name (eg, company) [Internet Widgits Pty Ltd]:MyCAOrganizational Unit Name (eg, section) []:MyCACommon Name (e.g. server FQDN or YOUR name) []:www.baidu.comEmail Address []:Please enter the following 'extra' attributesto be sent with your certificate requestA challenge password []:An optional company name []:D:\OpenSSL-Win64\bin>openssl x509 -req -in ca.csr -signkey ca.key -out ca.crtSignature oksubject=C = CN, ST = beijing, L = beijing, O = MyCA, OU = MyCA, CN = www.baidu.comGetting Private keyD:\OpenSSL-Win64\bin>openssl req -new -key server.key -out server.csrYou are about to be asked to enter information that will be incorporatedinto your certificate request.What you are about to enter is what is called a Distinguished Name or a DN.There are quite a few fields but you can leave some blankFor some fields there will be a default value,If you enter '.', the field will be left blank.-----Country Name (2 letter code) [AU]:CNState or Province Name (full name) [Some-State]:beijingLocality Name (eg, city) []:beijingOrganization Name (eg, company) [Internet Widgits Pty Ltd]:MyServerOrganizational Unit Name (eg, section) []:MyServerCommon Name (e.g. server FQDN or YOUR name) []:www.baidu.comEmail Address []:Please enter the following 'extra' attributesto be sent with your certificate requestA challenge password []:An optional company name []:D:\OpenSSL-Win64\bin>openssl x509 -req -CA ca.crt -CAkey ca.key -CAcreateserial -in server.csr -out server.crtSignature oksubject=C = CN, ST = beijing, L = beijing, O = MyServer, OU = MyServer, CN = www.baidu.comGetting CA Private KeyD:\OpenSSL-Win64\bin>openssl req -new -key client.key -out client.csrYou are about to be asked to enter information that will be incorporatedinto your certificate request.What you are about to enter is what is called a Distinguished Name or a DN.There are quite a few fields but you can leave some blankFor some fields there will be a default value,If you enter '.', the field will be left blank.-----Country Name (2 letter code) [AU]:CNState or Province Name (full name) [Some-State]:beijingLocality Name (eg, city) []:beijingOrganization Name (eg, company) [Internet Widgits Pty Ltd]:MyClientOrganizational Unit Name (eg, section) []:MyclientCommon Name (e.g. server FQDN or YOUR name) []:www.baidu.comEmail Address []:Please enter the following 'extra' attributesto be sent with your certificate requestA challenge password []:An optional company name []:D:\OpenSSL-Win64\bin>openssl x509 -req -CA ca.crt -CAkey ca.key -CAcreateserial -in client.csr -out client.crtSignature oksubject=C = CN, ST = beijing, L = beijing, O = MyClient, OU = Myclient, CN = www.baidu.comGetting CA Private KeyD:\OpenSSL-Win64\bin>dir驱动器 D 中的卷是 App卷的序列号是 C67B-0BC3D:\OpenSSL-Win64\bin 的目录2019/06/04 14:29 <DIR> .2019/06/04 14:29 <DIR> ..2019/06/04 14:27 1,236 ca.crt2019/06/04 14:27 1,022 ca.csr2019/06/04 14:25 1,706 ca.key2019/05/28 22:36 7,813 CA.pl2019/06/04 14:29 42 ca.srl2019/05/28 22:36 69,120 capi.dll2019/06/04 14:29 1,250 client.crt2019/06/04 14:28 1,030 client.csr2019/06/04 14:25 1,702 client.key2019/06/04 14:25 460 client.pem2019/05/28 22:36 44,544 dasync.dll2019/05/28 22:36 3,407,360 libcrypto-1_1-x64.dll2019/05/28 22:36 681,472 libssl-1_1-x64.dll2019/05/28 22:36 542,720 openssl.exe2019/05/28 22:36 44,032 ossltest.dll2019/05/28 22:36 39,936 padlock.dll2019/05/31 16:01 <DIR> PEM2019/05/28 22:36 5,562 progs.pl2019/06/04 14:28 1,250 server.crt2019/06/04 14:28 1,030 server.csr2019/06/04 14:24 1,706 server.key2019/06/04 14:25 460 server.pem2019/05/28 22:36 6,779 tsget.pl22 个文件 4,862,232 字节3 个目录 379,711,369,216 可用字节
报错:
org.apache.catalina.LifecycleException: Protocol handler start failedat org.apache.catalina.connector.Connector.startInternal(Connector.java:1008) ~[tomcat-embed-core-9.0.19.jar:9.0.19]at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.19.jar:9.0.19]at org.apache.catalina.core.StandardService.addConnector(StandardService.java:226) [tomcat-embed-core-9.0.19.jar:9.0.19]at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:259) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:197) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer(ServletWebServerApplicationContext.java:311) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:164) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) [spring-context-5.1.7.RELEASE.jar:5.1.7.RELEASE]at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]at com.jdcloud.httpszuul.HttpszuulApplication.main(HttpszuulApplication.java:15) [classes/:na]Caused by: java.lang.IllegalArgumentException: No SSLHostConfig element was found with the hostName [_default_] to match the defaultSSLHostConfigName for the connector [https-jsse-nio-8443]at org.apache.tomcat.util.net.AbstractJsseEndpoint.initialiseSsl(AbstractJsseEndpoint.java:76) ~[tomcat-embed-core-9.0.19.jar:9.0.19]at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:227) ~[tomcat-embed-core-9.0.19.jar:9.0.19]at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1116) ~[tomcat-embed-core-9.0.19.jar:9.0.19]at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1202) ~[tomcat-embed-core-9.0.19.jar:9.0.19]at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:568) ~[tomcat-embed-core-9.0.19.jar:9.0.19]at org.apache.catalina.connector.Connector.startInternal(Connector.java:1005) ~[tomcat-embed-core-9.0.19.jar:9.0.19]... 14 common frames omitted
导入证书