如何使用keytool使用SAN创建CSR [英] How to create CSR with SANs using keytool

查看:862
本文介绍了如何使用keytool使用SAN创建CSR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'd like to ask whether it is possible to create CSR that contains SAN records.

我创建的密钥库为

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

我可以使用keytool来检查SAN是否在密钥库中

I can check using keytool, that SAN is in keystore

keytool -list -v -keystore test.jks

输出的相关部分是

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

然后我使用keytool创建了CSR:

Then I created CSR using keytool:

keytool -certreq -file test.csr -keystore test.jks -alias testAlias

但是在CSR中,缺少有关SAN的信息.

but in CSR there is information about SAN missing.

如何检查:

keytool -printcertreq -file test.csr -v

正确地应该有类似的东西

correctly there should be something similar to

Extension Request:

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

我错过了certreq的某些选择吗?

Did I miss some option for certreq ?

推荐答案

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

when You generate CSR you need to specify -ext attribute again

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

这篇关于如何使用keytool使用SAN创建CSR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆