G
G
good_beginer2021-04-13 10:10:53
go
good_beginer, 2021-04-13 10:10:53

How to generate key.pem, cert.pem certificates from pfx or pem?

there is such code in golang and pfx and PEM certificates. I made pem from pfx. Wrote a request in PHP and the request passed.

cert, err := tls.LoadX509KeyPair("testdata/example-cert.pem", "testdata/example-key.pem")

  defaultTransport := http.DefaultTransport.(*http.Transport)

  tr := &http.Transport{
    Proxy:                 defaultTransport.Proxy,
    DialContext:           defaultTransport.DialContext,
    MaxIdleConns:          100,
    IdleConnTimeout:       30 * time.Second,
    ExpectContinueTimeout: defaultTransport.ExpectContinueTimeout,
    TLSHandshakeTimeout:   defaultTransport.TLSHandshakeTimeout,
    TLSClientConfig: &tls.Config{
      InsecureSkipVerify: true,
      Certificates:       []tls.Certificate{cert},
      //RootCAs:            caCertPool,
    },
  }


how to generate them correctly? or maybe the code is wrong

. The request must be to a third-party service (which gave the certificate) but does not pass SSL verification.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question