Skip to content

Commit

Permalink
showcert: Don't say valid if not valid
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosuav committed Oct 30, 2024
1 parent 395b3ca commit e3099b9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion showcert.pike
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ 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]);
write("Certificate valid until " + ctime(cert->validity[1]->get_posix()));
int valid = cert->validity[1]->get_posix();
if (valid < time()) write("Certificate EXPIRED at " + ctime(valid));
else write("Certificate valid until " + ctime(valid));
write("Subject: %s\n", cert->subject_str());
object alt = cert->extensions[SAN];
if (alt) write("Alternate: %s\n", alt->elements->value[*]);
Expand Down

0 comments on commit e3099b9

Please sign in to comment.