# How to use TLS client certificates with HTTP.jl

**URL:** https://discourse.julialang.org/t/how-to-use-tls-client-certificates-with-http-jl/40643
**Category:** Web Stack
**Tags:** https, certificate
**Created:** [June 3, 2020, 2:55am UTC](https://discourse.julialang.org/t/how-to-use-tls-client-certificates-with-http-jl/40643 "2020-06-03T02:55:08Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![bluesmoon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bluesmoon/32/327_2.png) [@bluesmoon](https://discourse.julialang.org/u/bluesmoon)
#### Post date: [June 3, 2020, 2:55am UTC](https://discourse.julialang.org/t/how-to-use-tls-client-certificates-with-http-jl/40643/1 "2020-06-03T02:55:08Z")

</div>

How do I connect to a HTTPS server that requires client certificates using HTTP.jl?

I can do this with LibCURL.jl with the following options:

```julia
    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1) # Verify the peer's SSL cert
    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2) # Verify the server's Common Name
    curl_easy_setopt(curl, CURLOPT_SSLVERSION, 7<<16) # Try highest version up to TLS 1.3

    curl_easy_setopt(curl, CURLOPT_SSLCERT, certpath) # Set the client cert path
    curl_easy_setopt(curl, CURLOPT_SSLKEY, keypath) # Set the client cert private key path

    curl_easy_setopt(curl, CURLOPT_CAINFO, cacertpath) # Set a CA cert path

```

I get various Garbage Collection related segfaults when using LibCURL.jl, so I’m looking into using HTTP.jl instead, however I cannot figure out from the docs how I’d set these TLS options.

Any help appreciated.

---

<div class="post-metadata">

### Author: ![schlichtanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/schlichtanders/32/32145_2.png) [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)
#### Post date: [February 24, 2023, 12:07pm UTC](https://discourse.julialang.org/t/how-to-use-tls-client-certificates-with-http-jl/40643/2 "2023-02-24T12:07:44Z")

</div>

@bluesmoon have you found a solution back then?

---

<div class="post-metadata">

### Author: ![bluesmoon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bluesmoon/32/327_2.png) [@bluesmoon](https://discourse.julialang.org/u/bluesmoon)
#### Post date: [February 24, 2023, 1:27pm UTC](https://discourse.julialang.org/t/how-to-use-tls-client-certificates-with-http-jl/40643/3 "2023-02-24T13:27:17Z")

</div>

No. I ended up making a higher level wrapper around LibCURL and using that. Much more versatile, even allows parallel downloads.

Figured out the GC issues were due to the order of command execution.

---

<div class="post-metadata">

### Author: ![bluesmoon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bluesmoon/32/327_2.png) [@bluesmoon](https://discourse.julialang.org/u/bluesmoon)
#### Post date: [September 29, 2023, 4:17pm UTC](https://discourse.julialang.org/t/how-to-use-tls-client-certificates-with-http-jl/40643/4 "2023-09-29T16:17:51Z")

</div>

If it still matters to you, I ended up releasing our fix as a new package: [GitHub - bluesmoon/CurlHTTP.jl: CurlHTTP is a wrapper around LibCURL that provides a more Julia like interface to doing HTTP via Curl.](https://github.com/bluesmoon/CurlHTTP.jl)
