处理 x509 crt 文件的用途时
openssl_x509_parse 的输出给出一个数组,其中包含以下用途
每个新数组(例如 [purposes][1]、[purposes][2])都是一个新的用途检查
我将此输出与以下命令的输出进行了比较
# openssl x509 -purpose -in <x509crt_file>
我得到的结果是
[purposes][x][2] 很明显是所检查用途的名称
[purposes][x][1] 对应于作为 CA 的测试用途(如 [purposes][x][2] 中命名的那样)
[purposes][x][0] 对应于用途的一般可用性
[purposes] => 数组
(
[1] => 数组
(
[0] => 1
[1] => 1
[2] => sslclient
)
[2] => 数组
(
[0] => 1
[1] => 1
[2] => sslserver
)
[3] => 数组
(
[0] => 1
[1] => 1
[2] => nssslserver
)
[4] => 数组
(
[0] => 1
[1] => 1
[2] => smimesign
)
[5] => 数组
(
[0] => 1
[1] => 1
[2] => smimeencrypt
)
[6] => 数组
(
[0] => 1
[1] => 1
[2] => crlsign
)
[7] => 数组
(
[0] => 1
[1] => 1
[2] => any
)
[8] => 数组
(
[0] => 1
[1] => 1
[2] => ocsphelper
)
)