HTTPS连接java CertificateException

时间:2014-02-20 05:33:45

标签: java soap https certificate

我们有domain.com的证书,但我们需要向sub.domain.com发送soap消息。 我们已将该证书添加到java cacerts中。创建SOAPConnection为:

SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();
SOAPConnection connection = scf.createConnection();
MessageFactory factory = MessageFactory.newInstance();

SOAPMessage msg = factory.createMessage();

SOAPMessage message = connection.call(msg, new URL("https://sub.domain.com/"));

在以这种方式发送消息时,我们会遇到异常:

java.security.cert.CertificateException: No name matching sub.domain.com found

我们需要为域sub.domain.com获取另一个证书,还是有另一种可能的方法来信任domain.com的所有子域名?

1 个答案:

答案 0 :(得分:0)

听起来你需要:

  1. A wildcard certificate;或
  2. 针对所有子域列出subject alternative names的证书