Posts
read more
Extracting Client Certificates
You can display all of the server’s certificates using the following command:
$ openssl s_client -showcerts server.name:port | sed -n '/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/p'
This output can be piped or copy/pasted to a text file (only keep the parts between the BEGIN and END CERTIFICATE sections) and give it a .crt file extension. You can then use it as input to whatever client app needs it.
In the below example we pipe the openssl output to grep to remove the identifiers of the certificates. You may not get your prompt back until the command times out, so you should wait a bit and after a bit you should get something similar to the following output: