Java 客户端证书验证在Spring启动时失败
我正在尝试创建一个应用程序,在这个应用程序中,我需要使用客户端的证书对客户端进行身份验证。 为了生成证书,我遵循了教程 我用客户机和服务器的公钥生成了Java密钥库 我将它们放在SpringBoot项目的类路径中,并将属性设置为Java 客户端证书验证在Spring启动时失败,java,spring,spring-boot,ssl,spring-security,Java,Spring,Spring Boot,Ssl,Spring Security,我正在尝试创建一个应用程序,在这个应用程序中,我需要使用客户端的证书对客户端进行身份验证。 为了生成证书,我遵循了教程 我用客户机和服务器的公钥生成了Java密钥库 我将它们放在SpringBoot项目的类路径中,并将属性设置为 server: port: 8443 # Define a custom port (instead of the default 8080) ssl: # The format used for the keystore key-store-
server:
port: 8443 # Define a custom port (instead of the default 8080)
ssl:
# The format used for the keystore
key-store-type: jks
key-store: classpath:MyServer.jks # The path to the keystore containing the certificate
key-password: password # The password used to generate the certificate
key-store-password: password
trust-store: classpath:MyServer.jks # Trust store that holds SSL certificates.
trust-store-password: password # Password used to access the trust store.
trust-store-type: JKS # Type of the trust store.
client-auth: need # Whether client authentication is wanted ("want") or needed ("need").
当我在浏览器中打开URL时,得到的错误如下
NET::ERR_CERT_COMMON_NAME_INVALID
This server could not prove that it is localhost; its security certificate does not specify Subject Alternative Names. This may be caused by a misconfiguration or an attacker intercepting your connection.
但是,当我换房子的时候
client-auth: want
它会打开URL。看起来它无法验证客户端证书。这里我缺少什么?您在证书中输入了哪些常用名称?我使用了教程中所示的原样,即
client.com
。然后为本地主机定义别名“client.com”。您在证书中输入了哪些常用名称?我使用了教程中所示的原样,即client.com
。然后定义别名本地主机的“client.com”