OpenSSL PEM Golang

Source: Internet
Author: User
Tags pkcs12

package mainimport  ("Crypto/tls" "FMT") func  main ()  {//loadx509keypair reads and parses a public/private key pair from a pair of files. The file must contain PEM-encoded data. _, err := tls. Loadx509keypair ("./cert_dist.pem",  "./key_dist2.pem") fmt. PRINTLN (Err)//x509keypair parses a public/private key pair from a pair of PEM-encoded data.  _, err = tls. X509keypair (Privatekey, publickey)// fmt. PRINTLN (Err)}//One, generate temporary files through P12 Cert.pem// openssl pkcs12 -clcerts -nokeys -out cert _dist.pem -in dist.p12 -passin pass://second, generate temporary files key.pem// openssl pkcs12 - Nocerts -out key_dist.pem -in dist.p12 -passin pass: -passout pass : 1234//Three, remove the password of Key.pem// openssl rsa -in key_dist.pem -out key_dist2.pem - passin pass:1234//four, search// _, err := tls. Loadx509keypair (CERT.PEM, KEY.UNENCRYPTED.PEM)//fmt. PRINTLN (ERR) 

OpenSSL Pem Golang

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.