@@ -552,6 +552,7 @@ func LogCertificate(w http.ResponseWriter, cert *x509.Certificate) {
552552 "serial" : cert .SerialNumber .String (),
553553 "subject" : cert .Subject .CommonName ,
554554 "issuer" : cert .Issuer .CommonName ,
555+ "sans" : fmtSans (cert ),
555556 "valid-from" : cert .NotBefore .Format (time .RFC3339 ),
556557 "valid-to" : cert .NotAfter .Format (time .RFC3339 ),
557558 "public-key" : fmtPublicKey (cert ),
@@ -625,6 +626,31 @@ func ParseCursor(r *http.Request) (cursor string, limit int, err error) {
625626 return
626627}
627628
629+ func fmtSans (cert * x509.Certificate ) map [string ][]string {
630+ sans := make (map [string ][]string )
631+ if len (cert .DNSNames ) > 0 {
632+ sans ["dns" ] = cert .DNSNames
633+ }
634+ if len (cert .EmailAddresses ) > 0 {
635+ sans ["email" ] = cert .EmailAddresses
636+ }
637+ if size := len (cert .IPAddresses ); size > 0 {
638+ ips := make ([]string , size )
639+ for i , ip := range cert .IPAddresses {
640+ ips [i ] = ip .String ()
641+ }
642+ sans ["ip" ] = ips
643+ }
644+ if size := len (cert .URIs ); size > 0 {
645+ uris := make ([]string , size )
646+ for i , u := range cert .URIs {
647+ uris [i ] = u .String ()
648+ }
649+ sans ["uri" ] = uris
650+ }
651+ return sans
652+ }
653+
628654func fmtPublicKey (cert * x509.Certificate ) string {
629655 var params string
630656 switch pk := cert .PublicKey .(type ) {
0 commit comments