gpt4 book ai didi

ssl - 如何将主题备用名称添加到 ssl 证书?

转载 作者:太空宇宙 更新时间:2023-11-03 12:37:19 29 4
gpt4 key购买 nike

我正在使用 openssl 创建自签名证书。我生成的证书出现此错误:

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


有谁知道在创建证书时如何指定“主题备用名称”?这就是我生成 keystore 的方式:

sudo $JAVA_HOME/bin/keytool -genkey -dname "CN=192.168.x.xxx, OU=I, O=I, L=T, ST=On, C=CA" -alias tomcat -validity 3650 -keyalg RSA -keystore /root/.keystore -keypass abcd -storepass abcd

生成 key :

 openssl s_client -connect 192.168.x.xxx:8443 2>/dev/null

求助!谢谢!

最佳答案

尽管this question更具体地说是关于 Subject Alt 中的 IP 地址。名称,命令类似(使用主机名的 DNS 条目和 IP 地址的 IP 条目)。

引用我自己的话:

If you're using keytool, as of Java 7, keytool has an option to include a Subject Alternative Name (see the table in the documentation for -ext): you could use -ext san=dns:www.example.com or -ext san=ip:10.0.0.1

请注意,您只需要 Java 7 的 keytool 即可使用此命令。准备好 keystore 后,它应该可以与以前版本的 Java 一起使用。

(此答案的其余部分还提到了如何使用 OpenSSL 执行此操作,但它似乎不是您正在使用的。)

关于ssl - 如何将主题备用名称添加到 ssl 证书?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8744607/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com