certificate - 如何使用 keytool 使用 SAN 创建 CSR

标签 certificate keytool

我想问一下是否可以创建包含 SAN 记录的 CSR。

我创建了 keystore

keytool -genkeypair -keyalg RSA -keysize 2048 -alias testAlias -ext SAN=dns:test.example.com -keystore test.jks -storetype JKS -dname "CN=test"

我可以使用 keytool 检查 SAN 是否在 keystore 中
keytool -list -v -keystore test.jks

和输出的相关部分是
#1: ObjectId: 2.5.29.17 Criticality=false
SubjectAlternativeName [
  DNSName: test.example.com
]

然后我使用 keytool 创建了 CSR:
keytool -certreq -file test.csr -keystore test.jks -alias testAlias

但在 CSR 中缺少有关 SAN 的信息。

如何检查:
keytool -printcertreq -file test.csr -v

正确应该有类似的东西
Extension Request:

#1: ObjectId: 2.5.29.17 Criticality=false
SubjectAlternativeName [
  DNSName: test.example.com
]

我是否错过了 certreq 的某些选项? ?

最佳答案

当您生成 CSR 时,您需要指定 -ext 再次属性

keytool -certreq -file test.csr -keystore test.jks -alias testAlias -ext SAN=dns:test.example.com

关于certificate - 如何使用 keytool 使用 SAN 创建 CSR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30755220/

相关文章:

两个 WebApp 之间的 SSL 握手

java - 证书中的主机名在 OAuth 请求中不匹配

ios - 在 iOS 中动态创建 x509 证书

java - 从java.net下载openjdk12的证书问题

ssl - .keystore 文件的问题

android - Keytool 别名不存在

bouncycaSTLe - 创建 BKS keystore 时出现 keytool 错误 : providerpath is not a legal command

java - 如何将 SSL 证书添加到 cacerts 和 keystore ?

ssl - 如何从多个文件创建可用的证书存储