FISCO-BCOS/web3sdk

General SSLEngine problem 错误

zhige2003 opened this issue · 1 comments

我使用web3sdk的源代码建立web工程,利用节点生成的client.keystore文件,并放在了classes路径下,启动的时候,提示下面的内容,请大神看看是什么原因。谢谢
01:12:07.674 DEBUG org.bcos.channel.client.Service$ConnectionCallback 74 onConnect - 已建立连接,将topic发送到该连接:60ead22418294a009eddd53e12be293d
01:12:07.675 DEBUG org.bcos.channel.client.Service$ConnectionCallback 78 onConnect - topics: []
01:12:07.679 ERROR org.bcos.channel.handler.ChannelHandler 147 exceptionCaught - 网络错误 io.netty.handler.codec.DecoderException: javax.net.ssl.SSLHandshakeException: General SSLEngine problem
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:459) ~[netty-all-4.1.15.Final.jar:4.1.15.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265) ~[netty-all-4.1.15.Final.jar:4.1.15.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-all-4.1.15.Final.jar:4.1.15.Final]

经多次尝试,发现是由于client.keystore生成有问题,正常用此方式
FISCO-BCOS中client.keystore 的生成方法
1、client.keystore是用做web3sdk的SSL证书。
2、在web3sdk V1.0.0中,client.keystore里面有两个证书,一个client证书,一个ca证书。client.keystore的密码必须为“123456”,keystore中有私钥的client证书的密码也必须为“123456”。

V1.0.0版本的client.keystore生成方式:

(1)keytool -import -trustcacerts -alias ca -file ca.crt -keystore client.keystore
(2)openssl pkcs12 -export -name client -in server.crt -inkey server.key -out keystore.p12
(3)keytool -importkeystore -destkeystore client.keystore -srckeystore keystore.p12 -srcstoretype pkcs12 -alias client
(4)、Attention! Password must be ”123456”
注意:其中用到的ca.crt,必须是节点的ca.crt。server.crt,server.key 必须是节点的或者节点的兄弟证书(同一CA颁发)。