summaryrefslogtreecommitdiff
path: root/bin-src
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@datawire.io>2018-12-26 16:55:09 -0500
committerLuke Shumaker <lukeshu@datawire.io>2018-12-26 16:55:09 -0500
commit0dd93f25fbbbc50105665e647beea70c3b7f2ac5 (patch)
tree6d283523237ed73ca66df024a99d73573b7e7d70 /bin-src
parent56087b0ea0d53640f1f1fe0656eed064463b2c8f (diff)
crtsh-pem2html: Properly display rows with only precerts
Diffstat (limited to 'bin-src')
-rw-r--r--bin-src/crtsh-pem2html.go25
1 files changed, 16 insertions, 9 deletions
diff --git a/bin-src/crtsh-pem2html.go b/bin-src/crtsh-pem2html.go
index 432020e..f916bf6 100644
--- a/bin-src/crtsh-pem2html.go
+++ b/bin-src/crtsh-pem2html.go
@@ -56,12 +56,12 @@ var tmpl = template.Must(template.New("pem2html").
<th>SCTs</th>
</tr>
{{range $cert := .certs}}
- <tr>
- <td style="background-color: {{$cert.Updated | green}}"><a target="_blank" href="{{$cert.Main.Url}}">{{$cert.Updated | date}}</a></td>
- <td style="background-color: {{$cert.Main.X509.NotBefore | green}}"><a target="_blank" href="{{$cert.Main.Url}}">{{$cert.Main.X509.NotBefore | date}}</a></td>
- <td style="background-color: {{$cert.Main.X509.NotAfter | red }}"><a target="_blank" href="{{$cert.Main.Url}}">{{$cert.Main.X509.NotAfter | date}}</a></td>
- <td><a target="_blank" href="{{$cert.Main.Url}}">{{$cert.Main.X509.Subject.CommonName}}</a></td>
- <td><a target="_blank" href="{{$cert.Main.Url}}">{{$cert.Main.X509.Issuer.Organization}}</a></td>
+ <tr {{if $cert.IsValid|not}}class="invalid"{{end}}>
+ <td style="background-color: {{$cert.Updated | green}}"><a target="_blank" href="{{$cert.Main.Url}}">{{$cert.Updated | date}}</a></td>
+ <td style="background-color: {{(index $cert 0).X509.NotBefore | green}}"><a target="_blank" href="{{$cert.Main.Url}}">{{(index $cert 0).X509.NotBefore | date}}</a></td>
+ <td style="background-color: {{(index $cert 0).X509.NotAfter | red }}"><a target="_blank" href="{{$cert.Main.Url}}">{{(index $cert 0).X509.NotAfter | date}}</a></td>
+ <td><a target="_blank" href="{{$cert.Main.Url}}">{{(index $cert 0).X509.Subject.CommonName}}</a></td>
+ <td><a target="_blank" href="{{$cert.Main.Url}}">{{(index $cert 0).X509.Issuer.Organization}}</a></td>
<td>{{range $i, $sct := $cert.Precerts}}
<a target="_blank" href="{{$sct.Url}}">[{{$i}}]</a>
{{end}}</td>
@@ -142,14 +142,21 @@ func NewCertSet(certs []Cert) []CertSet {
return ret
}
+func (certs CertSet) IsValid() bool {
+ return !util.IsPrecertificate(certs[0].X509)
+}
+
func (certs CertSet) Main() Cert {
- //if util.IsPrecertificate(certs[0].X509) {
- // return Cert{X509: new(x509.Certificate)}
- //}
+ if util.IsPrecertificate(certs[0].X509) {
+ return Cert{X509: new(x509.Certificate)}
+ }
return certs[0]
}
func (certs CertSet) Precerts() []Cert {
+ if util.IsPrecertificate(certs[0].X509) {
+ return certs
+ }
return certs[1:]
}