Php solves the problem of garbled characters when reading der certificates. Php reading der format certificate garbled solution this article mainly introduces php reading der format certificate garbled solution related information, need friends can refer to the problem encountered below: how to solve the garbled error in reading der-format certificates in my php
This article describes how php can solve the problem of reading the der-format certificate garbled characters. For more information, see
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 encode the content with tags before that. Otherwise, the content is not garbled, but cannot be identified by your browser. 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:
?
1 2 3 4 5 6 |
$ 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.
This article describes how to solve the garbled code of the der format certificate in php. if you need it, you can refer to the following problems: my...