Openssl

想要一個 sha256 ssl 證書,但我得到了 sha1,為什麼?

  • January 8, 2017

我使用這個程序

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

在 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"

引用自:https://unix.stackexchange.com/questions/232831