From 57f8b6ec7591007ff22627038b51c4f4aa2a9be8 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sat, 30 Dec 2017 03:07:47 +0100 Subject: libsec: implement SPKI fingerprinting for okCertificate() Instead of only using a hash over the whole certificate for white/black-listing, now we can also use a hash over the Subject Public Key Info (SPKI) field of the certificate which contians the public key algorithm and the public key itself. This allows certificates to be renewed independendtly of the public key. X509dump() now prints the public key thumbprint in addition to the certificate thumbprint. tlsclient will print the certificate when run with -D flag. okCertificate() will print the public key thumbprint in its error string when no match has been found. --- sys/src/cmd/tlsclient.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sys/src/cmd/tlsclient.c') diff --git a/sys/src/cmd/tlsclient.c b/sys/src/cmd/tlsclient.c index 1b79fb739..7be56c279 100644 --- a/sys/src/cmd/tlsclient.c +++ b/sys/src/cmd/tlsclient.c @@ -49,6 +49,8 @@ main(int argc, char **argv) Thumbprint *thumb; AuthInfo *ai = nil; + fmtinstall('B', mpfmt); + fmtinstall('[', encodefmt); fmtinstall('H', encodefmt); ARGBEGIN{ @@ -122,6 +124,9 @@ main(int argc, char **argv) if(fd < 0) sysfatal("tlsclient: %r"); + if(debug) + X509dump(conn->cert, conn->certlen); + if(thumb){ if(!okCertificate(conn->cert, conn->certlen, thumb)) sysfatal("cert for %s not recognized: %r", servername ? servername : addr); -- cgit v1.2.3