使用openssl生成sha256自签名证书

首先建立ca

生成 RSA 密钥对:

openssl genrsa -out ca.key 2048

若想对私钥进行加密可以加上 -des3 参数

生成 ca crt:

openssl req -new -x509 -days 365 -key ca.key -out ca.crt

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‘.’, the field will be left blank.
Country Name (2 letter code) [XX]:CN # 国家代码
State or Province Name (full name) []:XX # 省份
Locality Name (eg, city) [Default City]:XX # 城市
Organization Name (eg, company) [Default Company Ltd]:XX # 组织名称
Organizational Unit Name (eg, section) []:XX # 组织单元名称
Common Name (eg, your name or your server’s hostname) []:XX # 由此ca签的证书颁发者名
Email Address []:[email protected] #使用者的邮箱

sha256

站点证书的生成

生成证书的RSA 密钥(当然你要是很懒同时测试使用,也可以直接使用CA的KEY)

openssl genrsa -out xxx.key 2048

生成csr证书(假设需要签SSL证书的域名为: yoursafe.cn):

openssl req -new -key xxx.key -subj "/C=CN/ST=XX/L=XX/O=XX/OU=XX/CN=XX" -sha256 -out xxx.csr

注:中间的参数请参考上方,使用 -subj 可以简化一些证书信息的录入过程,使用 -sha256 将采用sha256加密,openssl默认采用sha1加密,而现代已将 sha1 加密方式认定为非安全,故使用sha2。

检查 csr 的正确性:

openssl req -in xxx.csr -text

检查其中 Signature Algorithm 是不是 sha256WithRSAEncryption。

利用 ca 生成 crt:

openssl x509 -req -days 365 -in xxx.csr -CA ca.crt -CAkey ca.key -sha256 -out xxx.crt

检查 crt 的正确性:

openssl x509 -in xxx.crt -text

同样检查 Signature Algorithm 是不是sha256WithRSAEncryption。

相关推荐:
有人说可以使用export进行全局的代理设置,但是这时候会影响大量的服务正常使用,所以有必要只对git做特殊的处理。其实git早已经准备了这样的入口,可以通过配置,让git在初始化时自动加载代理。 git clone …
漏洞描述: 2018年4月26日,Drupal官方发布新补丁和安全公告,宣称Drupal 7,8等多个子版本存在远程代码执行漏洞,攻击者可以利用Drupal网站漏洞,需要登录且有删除权限后触发执行恶意代码,导致网站被完全 …
首先我们来简单地普及下GUID, 即Globally Unique Identifier(全球唯一标识符) 也称作 UUID(Universally Unique IDentifier) 。 GUID是一个通过特定算法产生的二进制长度为128位的数字标识符,用于指示产 …
选项->参数设置->传送->传送模式->二进制(图象) 接着确认就行了。
在安装软件的过程中,出现 [waiting for headers] ,并且卡住一直没反应。这可能是源的问题,也可能是上一次缓存不完全导致的,以下提供了一些措施来帮你缓解。 rm /var/lib/apt/lists/* rm /var/lib/apt/l …
拿起手机扫一扫即可带走我!