Answer the question
In order to leave comments, you need to log in
How to implement SSL validation of a domain certificate?
Greetings, how can you, having domains, find out information about their certificates, and, accordingly, check whether other SSL errors have expired or not. Verification should be carried out without third-party api and services. You can use openSSL. Can you "poke" where to draw resources?
Answer the question
In order to leave comments, you need to log in
To start
openssl s_client -connect qna.habr.com:443
and start learning/parsing the relevant parts
require 'net/http'
require 'openssl'
domain_name = 'qna.habr.com'
uri = URI::HTTPS.build host: domain_name
response = Net::HTTP.start uri.host, uri.port, use_ssl: true
cert = response.peer_cert
# @return [Time]
cert.not_after
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question