summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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:]
}