原标题:用keytool生成tomcat证书
一些经验,希望对你有用
java我安装到了/opt/java,可以换成你自己的路径
KEYTOOL=/opt/java/bin/keytool
CACERTS=/opt/java/jre/lib/security/cacerts
DOMAIN=yunweibang.com(修改为你的二级域名)
DOMAIN_ALIAS=`echo $DOMAIN|sed 's/.//g'`
$KEYTOOL -delete -alias $DOMAIN_ALIAS -keystore $CACERTS -storepass changeit
$KEYTOOL -genkey -v -alias $DOMAIN_ALIAS -keyalg RSA -storetype pkcs12 -keystore keystore -validity 36500
-dname "CN=*.$DOMAIN,OU=$DOMAIN_ALIAS,O=$DOMAIN_ALIAS,L=BJ,ST=BJ,C=CN" -storepass changeit -keypass changeit
$KEYTOOL -export -alias $DOMAIN_ALIAS -storetype pkcs12 -keystore keystore -file $DOMAIN_ALIAS.cer -storepass changeit
$KEYTOOL -import -trustcacerts -alias $DOMAIN_ALIAS -keystore $CACERTS -file $DOMAIN_ALIAS.cer -storepass changeit返回搜狐,查看更多
责任编辑: