Tomcat使用keytool生成CSR

第一步: 使用Keytool命令生成 keystore

keytool -genkey -alias www_sslaaa_com -keyalg RSA -keysize 2048 -keystore www_sslaaa_com.keystore

将以上命令中的域名替换成你自己的域名。运行命令后需要回答一下问题

Enter keystore password: (输入keystore 密码,请记住该密码后面将会用到)
What is your first and last name? - 请在这里填写域名 如 www.sslaaa.com
What is the name of your organizational unit? 使用证书的部门,个人请随便填写如 IT Department
What is the name of your organization? 公司企业单位名称如 Zhongshan Leiming Network Technology Co., Ltd.
What is the name of your City or Locality? 填写所在的城市 如Guangzhou
What is the name of your State or Province? 填写所在的省 如Guangdong
What is the two-letter country code for this unit? 填写国家缩写代码 中国填写大写 CN

填写完 ,确认信息是否正确,请尽量使用英语或者拼音填写,在linux上使用中文输入可能会导致生成的CSR无法读取所填写的公司名称等信息的信息。

Is CN=www.sslaaa.com, OU=IT Department, O=Zhongshan Leiming Network Technology Co., Ltd., L=Guangzhou, ST=Guangdong, C=CN correct?

如果正确输入 yes , 然后会要求你输入key密码,请记住该密码,如果想使用和跟keystore密码一样,则按回车键。


第二步: 使用Keytool生成CSR

keytool -certreq -keyalg RSA -alias www_sslaaa_com -file www_sslaaa_com.csr -keystore www_sslaaa_com.keystore -sigalg SHA256withRSA

按照提示输入keystore的密码,然后会生成CSR文件  www_sslaaa_com.csr ,复制csr代码用于申请证书。

tomcat