Golang APNs certificate file conversion (P12 to Pem)

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

Golang does not support P12 parsing, so it needs to be converted to PEM


There are some, but not automatic conversions (non-interactive mode). The following conversions are non-interactive modes:

Generate temporary files Cert.pem, note passin and passout options

OpenSSL pkcs12-clcerts-nokeys-out cert.pem-in cert.p12-passin Pass:p12_pass

Generate Temporary Files Key.pem

OpenSSL pkcs12-nocerts-out key.pem-in cert.p12-passin pass:p12_pass-passout pass:tmp_pass

Remove the KEY.PEM password

OpenSSL rsa-in key.pem-out key.unencrypted.pem-passin Pass:tmp_pass

Generate Cert files that build Golang can process

Cert, Err: = TLS. Loadx509keypair (CERT.PEM, KEY.UNENCRYPTED.PEM)

This generates a certificate that Golang can handle.

Note:

P12_pass: password when generating the P12 file

Tmp_pass: The exported temporary password must be greater than or equal to 4 characters

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.