openssl 颁发者/主题格式差异

Leo*_*nid 3 openssl

我得到两个 OpenSSL 版本的不同颁发者/主题格式:OpenSSL 1.1.1 和 OpenSSL 1.0.2n。1.1.1 版本可以像 1.0.2n 那样格式化主题/发行者吗?

$ openssl x509 -in cert.pem -noout -issuer

# 1.1.1 11 Sep 2018
issuer=C = RU, O = TestOrg, OU = TestOrg Certification Authority, CN = rsa

# 1.0.2n 7 Dec 2017
issuer= /C=RU/O=TestOrg/OU=TestOrg Certification Authority/CN=rsa
Run Code Online (Sandbox Code Playgroud)

Sha*_*ell 5

您需要使用“-nameopt compat”选项。例如

openssl x509 -in cert.pem -noout -issuer -nameopt compat

来自文档:

-nameopt 选项

选项决定主题或发行人名称的显示方式。选项参数可以是单个选项,也可以是用逗号分隔的多个选项。或者,可以多次使用 -nameopt 开关来设置多个选项。有关详细信息,请参阅“名称选项”部分。

兼容

使用旧格式。这相当于根本不指定名称选项。