How to solve the problem of php reading der-format certificate garbled code, php reading der garbled code _ PHP Tutorial

Source: Internet
Author: User
Php solves the problem of reading the der format certificate garbled; php reads the der garbled. Php reads the der format certificate garbled solution, php reads der garbled problem: my project needs to use the certificate public key in der format and RSA algorithm to verify the signature, PHP: how to solve the problem of php reading der format certificate garbled; php reading der garbled

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, it is best to use it before that. Encode the tag. Otherwise, the tag 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:

<? 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.

Token problems: my project needs to use the certificate public key in der format and the RSA algorithm to verify the signature, PHP about...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.