I am solving some CTF lab. I send a request and get response in which it contains cookie. Cookie has three element. First is token and something that is ecdsa signed. The second is domain name. The third is path. The question I want to know is if I get public key from domain name or something like that.


I want to use public key for ECDSA signature. The source code is saying that private key is generated using secure random library.

1 Answer 1


use -showcerts for the full chain:

openssl s_client -connect www.host.com:443

public key:

openssl s_client -connect www.host.com:443 | openssl x509 -pubkey -noout
  • You do not use " -showcerts" in your command line. I guess that's a typo.
    – A. Hersean
    Dec 4, 2018 at 16:52
  • 1
    @A.Hersean: by default openssl s_client will output the clients certificate as PEM. -showcerts is only needed if also the chain certificates should be printed. Dec 4, 2018 at 17:29
  • @DarkMatter: you might need to add -servername option to use SNI extension. Otherwise you might get not the expected certificate with servers where multiple certificates are used on the same IP:port. Dec 4, 2018 at 17:33
  • Thanks for all for your answers. But I missed something in the question. I want to use public key for ECDSA signature. The private key is using securerandom. But I am not sure the one you say can be used for it.
    – koker
    Dec 6, 2018 at 3:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .