![想要 sha256 ssl 证书,但我得到 sha1,为什么?](https://linux22.com/image/74063/%E6%83%B3%E8%A6%81%20sha256%20ssl%20%E8%AF%81%E4%B9%A6%EF%BC%8C%E4%BD%86%E6%88%91%E5%BE%97%E5%88%B0%20sha1%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%EF%BC%9F.png)
我使用这个程序
openssl req -newkey rsa:2048 -sha256 -subj "/C=IT/ST=Lazio/L=Roma/O=Blu/CN=server.server.server" -keyout ssl.key -out ssl.req -passout file:"/root/pass" ;done
#sign certificate
openssl ca -passin file:"/root/pass" -out key.crt -infiles ssl.req ;done
#removepass
for i in *key;do openssl rsa -in $i -out $i -passin file:"/root/pass" ;done
我添加了-sha256,但生成了sha1
答案1
在 openssl.cnf 上找到解决方案
default_days = 1000 # how long to certify for
default_crl_days= 30 # how long before next CRL
default_md = default # use public key default MD
preserve = no # keep passed DN ordering
变得
default_days = 1000 # how long to certify for
default_crl_days= 30 # how long before next CRL
default_md = sha256 # use public key sha256
preserve = no # keep passed DN ordering
然后与
openssl req -nodes -sha256 -newkey rsa:2048 -subj "/C=IT/ST=Lazio/L=Roma/O=Blu/CN=server.server.server" -keyout ssl.key -out ssl.req -passout file:"/root/pass"