GOLANG/TLS Mining Pit

Source: Internet
Author: User
This is a created article in which the information may have evolved or changed.

Today in the development of the HTTPS part of the Gsweb encountered a magical bug, recorded here for similar problems encountered by the classmate reference.
The cause of the matter is this:

I got a self-signed web certificate from my keychain at OSX 10.10, and I exported it for LISTENANDSERVETLS. Then Golang is not face to me. Always error: Crypto/tls:failed to parse key PEM data

Solutions

  • Google a little bit to find Beego a issue also mentioned this problem. This link is mentioned in the inside;
  • Read the last link, found it seems that the problem is X509keypair format is not correct;
  • In this way, the public key format was changed to the "-----begin CERTIFICATE-----" format;
  • Run the program or not;
  • No way, only read the source code of the Golang. Found in the source code there is a program $goapth/libexec/src/crypto/tls/generate_cert.go;
  • Using this program to generate a new certificate, the problem is solved!!!!!

Conclusion

Should it be a x509keypair format problem, either Golang only supports a specific format, or is there any configuration parameters? Ask the expert to answer???

Related Article

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.