从.pem文件读取公用名 [英] Read common name from .pem file

查看:171
本文介绍了从.pem文件读取公用名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有办法从我的shell中的.pem文件中读取公用名称。

is there a way to read the common name from a .pem file in my shell?

感谢

推荐答案

首先,.pem扩展名只引用文件中使用的编码类型。
通用名称是证书的主题或颁发者的功能。

First off, the .pem extension only refers to the type of encoding used in the file. The common name would be a feature of the Subject or Issuer of a certificate.

如果.pem文件包含 x509证书
这应该做的诀窍:

If the .pem file contains an x509 certificate, this should do the trick:

openssl x509 -in cacert.pem -noout -text

这将转储整个证书。 openssl x509 命令有几个选项来抑制您不想看到的字段。您可以在手册页中的 文本选项

This will dump the whole certificate. The openssl x509 command has several options to suppress the fields you don't want to see. You find those explained in the man page, under TEXT OPTIONS

这篇关于从.pem文件读取公用名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆