openssl 自签名证书SHA1加密算法

openssl genrsa -out privkey.pem 2048 
openssl req -new -key privkey.pem  -sha1 -out cert.csr 
openssl req -new -x509 -key privkey.pem -sha1 -out cacert.pem -days 36000

  

privkey.pem是私钥,后缀名可以自己改成.key

cert.csr是证书请求文件用于生成公钥数字证书,这个只在签名过程中有用,最终传到服务器上的一个是privkey.pem,一个是下面的公钥cacert.pem

cacert.pem是生成的公钥数字证书

验证方式

https://csr.chinassl.net/decoder-ssl.html

把公钥文件粘贴进去验证即可看到加密方式为SHA1withRSA

默认openssl生成的为SHA256withRSA,阿里云上证书申请的也是256的,加密方式无法转换,但有SHA1这个需求,如果需要其他的加密算法,可以openssl --help查看

猜你喜欢

转载自www.cnblogs.com/dribs/p/12160605.html