2011-06-23 36 views
1

我有证书,可以在浏览器中看到 - 由Verisign签名 - G3 但是当我尝试使用OpenSSL读取(或PHP)像PKCS12或X509或PKCS7 - 错误,如:PHP确定SSL证书的类型

openssl pkcs12 -in cert.to.test.cer -clcerts -nokeys -out mycert.crt 

28685:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1306: 
28685:error:0D06C03A:asn1 encoding routines:ASN1_D2I_EX_PRIMITIVE:nested asn1 error:tasn_dec.c:830: 
28685:error:0D08303A:asn1 encoding routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 error:tasn_dec.c:749:Field=version, Type=PKCS12 

如何在PHP中读取证书参数? 谢谢。

回答

3

您可以尝试

openssl x509 -in certificate.der -inform der -text -noout 

可能是DER编码的证书