想要 sha256 ssl 证书,但我得到 sha1,为什么?

想要 sha256 ssl 证书,但我得到 sha1,为什么?

我使用这个程序

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"

相关内容