以1.a.com.p7b证书为例,转换为1.a.com.crt
fold -w 64 1.a.com.p7b > temp.p7b
openssl pkcs7 -print_certs -in temp.p7b |grep -Ev ‘^\s*$|subject|issuer‘ > 1.a.com.crt
对应脚本
#!/bin/bash
p7b_file="$1"
p7b_filename=$(echo ${p7b_file} |sed -r ‘s#(.*).p7b#\1#g‘)
usage ()
{
echo "Usage:sh $0 p7b_file"
exit 0
}
[ $# -ne 1 ] && usage
fold -w 64 ${p7b_file} > temp.p7b
openssl pkcs7 -print_certs -in temp.p7b |grep -Ev ‘^\s*$|subject|issuer‘ > ${p7b_filename}.crt
sh p7b_to_crt.sh p7b文件
sh p7b_to_crt.sh owner1a_520wdy_com.p7b
生成的crt在当前目录下,与p7b文件同名。
原文:http://blog.51cto.com/xoyabc/2058746