From 36aeaec0b6a04edf7887ecc57393ce2962a6e39c Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 26 Dec 2018 14:46:37 -0500 Subject: first pass at precertificate support --- bin-src/crtsh-pem2html.go | 12 ++++++++++++ bin-src/util/oid.go | 10 ++++++++++ 2 files changed, 22 insertions(+) create mode 100644 bin-src/util/oid.go diff --git a/bin-src/crtsh-pem2html.go b/bin-src/crtsh-pem2html.go index 109917c..c0b815c 100644 --- a/bin-src/crtsh-pem2html.go +++ b/bin-src/crtsh-pem2html.go @@ -28,10 +28,20 @@ func handleBool(ok bool, str string, a ...interface{}) { } } +func rfc6962type(certX509 *x509.Certificate) string { + for _, ext := range certX509.Extensions { + if ext.Id.Equal(util.OID_RFC6962_Poison) { + return "Precertificate" + } + } + return "Certificate" +} + var tmpl = template.Must(template.New("pem2html"). Funcs(template.FuncMap{ "red": red, "green": green, + "rfc6962type": rfc6962type, "date": util.Date2HTML, "datetime": util.DateTime2HTML, "colorDatetime": util.DateTime2ColorHTML, @@ -43,6 +53,7 @@ var tmpl = template.Must(template.New("pem2html"). Logged NotBefore NotAfter + Type Subject.CN Issuer.O @@ -51,6 +62,7 @@ var tmpl = template.Must(template.New("pem2html"). {{$cert.Updated | date}} {{$cert.X509.NotBefore | date}} {{$cert.X509.NotAfter | date}} + {{$cert.X509 | rfc6962type}} {{$cert.X509.Subject.CommonName}} {{$cert.X509.Issuer.Organization}} diff --git a/bin-src/util/oid.go b/bin-src/util/oid.go new file mode 100644 index 0000000..b9fee4c --- /dev/null +++ b/bin-src/util/oid.go @@ -0,0 +1,10 @@ +package util + +import ( + "encoding/asn1" +) + +var ( + OID_RFC6962_SCTs = asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 11129, 2, 4, 2} + OID_RFC6962_Poison = asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 11129, 2, 4, 3} +) -- cgit v1.1-4-g5e80