问题:想要通过openssl命令在linux系统上面解密证书文件,提取信息(先了解一些证书基本概念)

https://www.cnblogs.com/leslies2/p/7442956.html#p0

一、什么是数字证书,常见格式

证书主要的文件类型和协议有: PEM、DER、PFX、JKS、KDB、CER、KEY、CSR、CRT、CRL 、OCSP、SCEP等。

二、生成数字证书的方式

数字证书可以通过在线工具,脚本代码,KEYTOOL工具,OPENSSL工具等多种方式生成。下面以常用的RSA非对称加密为例子,向大家介绍几种常用的数字证书生成方式。

三、openssl查看pem格式证书细节

openssl x509 -in cacert.pem -noout -text

2.查看证书序列号

openssl x509 -in cacert.pem -noout -serial

 3.打印证书名称以RFC2253规定的格式打印出证书的拥有者名字

openssl x509 -in cert.pem -noout -subject

openssl x509 -in cert.pem -noout -subject -nameopt RFC2253

 

4.在支持UTF8的终端一行过打印出证书的拥有者名字
 

openssl x509 -in cert.pem -noout -subject -nameopt oneline

5.打印出证书的MD5特征参数
 

openssl x509 -in cert.pem -noout -fingerprint

 

6.打印出证书的SHA特征参数
 

openssl x509 -sha1 -in cert.pem -noout -fingerprint

 

7.把PEM格式的证书转化成DER格式
 

openssl x509 -in cert.pem -inform PEM -out cert.der -outform DER

8.把一个证书转化成CSR
 

openssl x509 -x509toreq -in cert.pem -out req.pem -signkey key.pem

9.给一个CSR进行处理,颁发字签名证书,增加CA扩展项
 

openssl x509 -req -in careq.pem -extfile openssl.cnf -extensions v3_ca -signkey key.pem -out cacert.pem

10.给一个CSR签名,增加用户证书扩展项
 

openssl x509 -req -in req.pem -extfile openssl.cnf -extensions v3_usr -CA cacert.pem -CAkey key.pem -CAcreateserial

 

GitHub 加速计划 / ope / openssl
25.12 K
9.99 K
下载
传输层安全性/安全套接层及其加密库
最近提交(Master分支:26 天前 )
fd39d1c8 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/25095) 2 个月前
ae87c488 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/25095) 2 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐