summaryrefslogtreecommitdiff
path: root/bin-src/util
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@datawire.io>2018-12-26 15:40:10 -0500
committerLuke Shumaker <lukeshu@datawire.io>2018-12-26 15:40:10 -0500
commit20376a66d52ea418213bb5ac7e9328cd0d513851 (patch)
tree181f6edb070f8e5bf4211feea1b4104bd59fe440 /bin-src/util
parent36aeaec0b6a04edf7887ecc57393ce2962a6e39c (diff)
pem-diff: Learn about precertificates
Diffstat (limited to 'bin-src/util')
-rw-r--r--bin-src/util/oid.go10
-rw-r--r--bin-src/util/rfc6962.go26
2 files changed, 26 insertions, 10 deletions
diff --git a/bin-src/util/oid.go b/bin-src/util/oid.go
deleted file mode 100644
index b9fee4c..0000000
--- a/bin-src/util/oid.go
+++ /dev/null
@@ -1,10 +0,0 @@
-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}
-)
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
+}