有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java CertificateException:不存在主题替代名称

我在调用https Web服务时遇到以下异常

com.sun.xml.internal.ws.client.ClientTransportException: HTTP transport error: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative names present.

我正在用Java代码调用一个php Web服务。CN(通用名),即证书上的IP地址和我呼叫的IP地址是不同的。我已经在java密钥库中添加了证书。 有人能帮我弄清楚为什么会这样吗?我错在哪里? CN是服务器IP地址。由于防火墙问题,我正在使用我们提供的外部IP地址给那个服务器打电话


共 (1) 个答案

  1. # 1 楼答案

    The CN (Common name) i.e. IP on certificate is different and the IP i am calling is different.

    ...

    HTTP transport error: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative names present.

    当一个名字出现在通用名(CN)中时,它必须也出现在受试者备用名(SAN)中。您的证书格式不正确(可能还有其他问题)。见Baseline Requirements for the Issuance and Management of Publicly-Trusted Certificates,第9节(第9页和第10页):

    9.2.2 Subject Common Name Field

    Certificate Field: subject:commonName (OID 2.5.4.3)

    Required/Optional: Deprecated (Discouraged, but not prohibited)

    Contents: If present, this field MUST contain a single IP address or Fully-Qualified Domain Name that is one of the values contained in the Certificate’s subjectAltName extension (see Section 9.2.1).

    布鲁诺可能会引用RFC 6125中的相关章节