cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Saving the (public) certificate of a website to a file

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Thu, 1 Dec 2011 12:52:23 -0500

On Thu, Dec 1, 2011 at 12:18 PM, Alex Bligh <alex_at_alex.org.uk> wrote:

> I'm sure there is an easy way to do this, but a search of the manpage for
> the word 'certificate' does not seem to bring it up.
>
> How do I save the public certificate from a web page to a file?
>
> Various browsers allow you to do this.

Here's one way to pick up a server cert:

     openssl s_client -connect server.domain.com:443 > server.pem <
/dev/null

You'll probably want to edit the server.pem file to remove surplus bits on
either side of the BEGIN & END CERTIFICATE lines.

Ralph Mitchell

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-12-01