如何做CRT

首先看概念
https://zhuanlan.zhihu.com/p/26684050

得知我们需要根证书(CA)以及某个服务的证书。
假设根证书是example.com
服务证书是httpbin.example.com

第一步,创建根证书的私钥公钥对
openssl genrsa -des3 -out withpass.example.com.key 2048
openssl rsa -in withpass.example.com.key -out example.com.key

第二步,创建根证书,可能会报rnd警告,可以用openssl rand -writerand .rnd解决
openssl req -new -x509 -key example.com.key -out example.com.crt -days 3650 -subj '/O=example Inc./CN=example.com'

第三步,创建服务的私钥公钥对
openssl genrsa -des3 -out withpass.httpbin.example.com.key 2048
openssl rsa -in withpass.httpbin.example.com.key -out httpbin.example.com.key

第四步,创建服务的证书CSR
openssl req -new -key httpbin.example.com.key -out httpbin.example.com.csr -subj '/CN=httpbin.example.com/O=httpbin organization'

第五步,用CA的证书来生成服务的证书
openssl x509 -req -days 365 -CA example.com.crt -CAkey example.com.key -set_serial 0 -in httpbin.example.com.csr -out httpbin.example.com.crt

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容