Skip to content

Commit

Permalink
showcert: Also show validity, and reformat onto stdout for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosuav committed Oct 30, 2024
1 parent 7156ff4 commit 906b5f9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions showcert.pike
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ int main(int argc, array(string) argv) {
object ssl = SSL.File(sock, SSL.Context());
ssl->set_nonblocking(0) {
object cert = Standards.X509.decode_certificate(ssl->get_peer_certificates()[0]);
array(string) domains = ({cert->subject_str()});
write("Certificate valid until " + ctime(cert->validity[1]->get_posix()));
write("Subject: %s\n", cert->subject_str());
object alt = cert->extensions[SAN];
if (alt) domains += alt->elements->value;
werror("%O\n", domains);
if (alt) write("Alternate: %s\n", alt->elements->value[*]);
exit(0);
};
ssl->connect(domain);
Expand Down

0 comments on commit 906b5f9

Please sign in to comment.