将Fiddler的服务器证书导入到Java的cacerts证书库里

December 17, 2023
测试
测试
测试
测试
3 分钟阅读

我在将Fiddler作为Java应用的代理时,在使用Java代码连接Fiddler时遇到了SSL证书相关的错误:

liavax.net.ssl. SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building faiat sun. security.ssl.Alerts.getSSLException(Alerts.java:192) at sun. security.ssl. SSLSocketImpl. fatal(SSLSocketImpl. java:1949) at sun. security.ssl.Handshaker. fatalSE(Handshaker. java: 302) at sun. security. ssl. Handshaker.fatalSE(Handshaker. java: 296) at sun.security.ssl.ClientHandshaker.serverCertificate(clientHandshaker.java:1506) at sun.security.ssl.clientHandshaker.processMessage(clientHandshaker. java:216) at sun. security.ssl.Handshaker.processLoop(Handshaker.java:979) at sun. security.ssl.Handshaker.process_record(Handshaker. java:914) at sun. security.ssl. SSLSocketImpl.readRecord(SSLSocketImpl. java: 1062) at sun. security. ssl. SSLSocketImpl.performInitialHandshake(SSLSocketImpl. java:1375) at sun. security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403) at sun. security. ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387) at org. apache.http.conn. ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketat org. apache.http.impl.conn.DefaultHttpclientConnection0perator.upgrade(DefaultHttpclientConiat org. apache.http.impl. conn.PoolingHttpclientConnectionManager.upgrade(PoolingHttpclientConne

解决的办法:

从localhost:8888打开Fiddler Echo Service,点击FiddlerRoot certificate,将安全证书下载到本地,

然后用软件Portecle打开JDK的cacerts证书库,将Fiddler的证书导入即可。

当然不使用Portecle,直接用命令行也是可以的。导入之后,Java应用发送的请求,就能成功被Fiddler接收到了。

继续阅读

更多来自我们博客的帖子

如何安装 BuddyPress
由 测试 December 17, 2023
经过差不多一年的开发,BuddyPress 这个基于 WordPress Mu 的 SNS 插件正式版终于发布了。BuddyPress...
阅读更多
Filter如何工作
由 测试 December 17, 2023
在 web.xml...
阅读更多
如何理解CGAffineTransform
由 测试 December 17, 2023
CGAffineTransform A structure for holding an affine transformation matrix. ...
阅读更多