I got a digital certificate with extensions for server and client authentication and a private key.
Now I want to connect to a remote server (REST web services) which should accept my requests because of my certificate. As a first step I want to check if this connection will work. The remote server is not under my control.
I have this REST URL https://host.test.com/REST/admin/user/1212/ and I need to do the request with the certificate. So how can I do this through command line (Linux system)?
You can use curl or wget.
or
THe certificate (of course with priv key) needs to be located in a p12 file. You can specify the passphrase of this file.
You can use openssl s_client to inspect the certificate for validity.
This gives me:
The -CApath parameter point to the CA certificates to validate against. I'm on Arch Linux, hence these are in /usr/share/ca-certificates.
This is extremely handy when debugging certificates you rolled out, but equally useful, when you don't have control over the other side.
To use a client certificate add the following to the s_client command line:
Here xxx.pem contains both the client certificate and the key. You simply pass it to both options.