Php solves the problem of reading der-format certificate garbled characters. php reads der garbled characters.
Problems:
My project needs to use the certificate Public Key in der format and the RSA algorithm to verify the signature. PHP does not know much about the RSA algorithm, and there are Java and. net Language, PHP implementation is very difficult.
Answers from friends:
This certificate has its own encoding. First, you need to find this certificate. Then, you can use php to read the certificate and set the corresponding encoding. In addition, if you directly echo the certificate content, you 'd better use the <meta> label to encode it before that. Otherwise, it will not be garbled, but your browser will not be able to recognize it. Pay attention to the encoding of your php file ~~
The Direct Reading is garbled. The der key certificate is a binary or BASE64 encoded file. php can use the openssl_x509_parse function for parsing:
<? Php $ cert = file_get_contents ('filename. crt '); $ ssl = openssl_x509_parse ($ cert); var_dump ($ ssl);?>
The above is all the content of this article. I hope you will like it.