G
G
good_beginer2021-04-02 12:18:23
go
good_beginer, 2021-04-02 12:18:23

How to make a POST request using a certificate?

I can't figure out how, using GOLang, to make POST requests to third-party resources using certificates. I have pfx and pem which i made from pfx

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav, 2021-04-02
@ghostiam

You need a client certificate and a private key from it, as well as a CA certificate.
Next, you need to upload your certificates and configure http.Client.

...
  transport := &http.Transport{TLSClientConfig: tlsConfig}
  client := &http.Client{Transport: transport}

  resp, err := client.Post(...)
...

See the full code here (googled for "golang http request client certificate"):
https://gist.github.com/michaljemala/d6f4e01c4834b...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question