How to create CSR with SANs using keytool

孤街醉人 提交于 2019-12-20 10:06:24

问题


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

I created keystore as

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

I can check using keytool, that SAN is in keystore

keytool -list -v -keystore test.jks

and relevnt part of the output is

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

Then I created CSR using keytool:

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

but in CSR there is information about SAN missing.

How to check:

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
]

Did I miss some option for certreq ?


回答1:


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


来源:https://stackoverflow.com/questions/30755220/how-to-create-csr-with-sans-using-keytool

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!