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