SSL certificate challenges

I have a .pem file that contains a private and a public key.

I need help in order to extract the certificate and to send the request using httpoison.

Below is how I am currently doing it in Ruby and sending the request through Faraday gem.

SSL_OPTS={client_cert:, client_key:, 'testpem15')} => "https://ip:port", :ssl=>SSL_OPTS,
    :headers => HEADER) do |faraday|
    faraday.response :logger                  
    faraday.adapter  Faraday.default_adapter  

I am, however, rewriting the application in Elixir.

Any help will be most appreciated.



Off the top of my head, this should work:

HTTPoison.get("https://ip:port", [], ssl: [certfile: pem_file, password: 'testpem15'])

Note that the password needs to be a charlist.


Hello @voltone
Thanks for your response.

Below is what I get after I implemented your suggestion:

** (Poison.EncodeError) unable to encode value: {:options, {:certfile, {:ok, "Bag Attributes\n    localKeyID:...

It’s a very long error. I’ve just truncated it.

What could I be doing wrong?

My code is below:

options = [ssl: [certfile:"./partner.pem")), password: String.to_charlist("testpem15"), versions: [:'tlsv1.2']]]
   , str, req_header, options)   

Thanks for your help.

Don’t read the file contents, just pass the path in the certfile option


Hello @voltone

Many thanks for the help offered me.

It worked perfectly.

Thanks so much.



1 Like