From 20376a66d52ea418213bb5ac7e9328cd0d513851 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 26 Dec 2018 15:40:10 -0500 Subject: pem-diff: Learn about precertificates --- bin-src/util/rfc6962.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 bin-src/util/rfc6962.go (limited to 'bin-src/util/rfc6962.go') diff --git a/bin-src/util/rfc6962.go b/bin-src/util/rfc6962.go new file mode 100644 index 0000000..46a531b --- /dev/null +++ b/bin-src/util/rfc6962.go @@ -0,0 +1,26 @@ +package util + +import ( + "crypto/x509" + "encoding/asn1" + + //"fmt" + //"os" +) + +var ( + oidSCTs = asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 11129, 2, 4, 2} + oidPrecertificatePoison = asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 11129, 2, 4, 3} +) + +func IsPrecertificate(certX509 *x509.Certificate) bool { + for _, ext := range certX509.Extensions { + //fmt.Fprintln(os.Stderr, "ext", ext) + if ext.Id.Equal(oidPrecertificatePoison) { + //fmt.Fprintln(os.Stderr, "t") + return true + } + } + //fmt.Fprintln(os.Stderr, "f") + return false +} -- cgit v1.2.3