为了账号安全,请及时绑定邮箱和手机立即绑定

如何解决“ java.security.cert.CertificateException:

如何解决“ java.security.cert.CertificateException:

慕侠2389804 2019-10-08 11:11:52
我有一个Java Web服务客户端,它通过HTTPS使用Web服务。import javax.xml.ws.Service;@WebServiceClient(name = "ISomeService", targetNamespace = "http://tempuri.org/", wsdlLocation = "...")public class ISomeService    extends Service{    public ISomeService() {        super(__getWsdlLocation(), ISOMESERVICE_QNAME);    }当我连接到服务URL(https://AAA.BBB.CCC.DDD:9443/ISomeService)时,出现异常java.security.cert.CertificateException: No subject alternative names present。要修复它,我首先运行openssl s_client -showcerts -connect AAA.BBB.CCC.DDD:9443  > certs.txt并在file中得到以下内容certs.txt:CONNECTED(00000003)---Certificate chain 0 s:/CN=someSubdomain.someorganisation.com   i:/CN=someSubdomain.someorganisation.com-----BEGIN CERTIFICATE-----XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-----END CERTIFICATE--------Server certificatesubject=/CN=someSubdomain.someorganisation.comissuer=/CN=someSubdomain.someorganisation.com---No client certificate CA names sent---SSL handshake has read 489 bytes and written 236 bytes---New, TLSv1/SSLv3, Cipher is RC4-MD5Server public key is 512 bitCompression: NONEExpansion: NONEAFAIK,现在我需要提取的部分certs.txt之间-----BEGIN CERTIFICATE-----和-----END CERTIFICATE-----,对其进行修改,以使证书名称等于AAA.BBB.CCC.DDD和然后使用导入结果keytool -importcert -file fileWithModifiedCertificate(fileWithModifiedCertificate操作1和2的结果在哪里)。这个对吗?如果是这样,我如何才能使第1步中的证书与基于IP的地址(AAA.BBB.CCC.DDD)一起使用?
查看完整描述

3 回答

  • 3 回答
  • 0 关注
  • 2745 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信