There's an article here that might be useful to you:

https://www.lvh.io/posts/https-requests-with-client-certificates-in-clojure.html

With clj-http, you have to use a Java keystore. I wrote a library a few
years ago for importing certificates into keystores in Clojure, though I'm
not sure how well it works now. Otherwise you can use the normal Java
process.

https://github.com/weavejester/crypto-keystore

- James

On 21 February 2017 at 23:36, Pierre Masci <mas...@gmail.com> wrote:

> Hi, I am new to Clojure and using clj-http for the first time, to
> implement a REST client.
> I don't find anywhere how to indicate where my SSL certificate is located.
> Here is what I did:
>
> (ns my-client.core
>   (:require [clj-http.client :as client]
>             [clojure.pprint :refer :all]))
>
> (def my-appkey "...")
>
> (defn login [username password appkey]
>   (client/post "https://.../api/certlogin";
>                {:headers     {"X-Application" appkey
>                               "Content-Type" 
> "application/x-www-form-urlencoded"}
>                 :form-params {"username" username "password" password}}))
>
> (defn -main []
>   (pprint (login "..." "..." my-appkey)))
>
>
> This sends me back a response which indicates that I need to send the SSL
> certificate.
> When I send the same request with curl and indicate the certificates, it
> works. This is the successful curl request:
>
> curl -q -k --cert client-2048.crt --key client-2048.key 
> https://.../api/certlogin
> -d "username=...&password=..." -H "X-Application: ..."
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to