From 3c63e473bdb41c1e8cb194df6f523a69efa31dc8 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Fri, 25 Dec 2020 19:56:17 -0500 Subject: [PATCH] new changes --- routes/get.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/routes/get.go b/routes/get.go index aafba39..20114d8 100644 --- a/routes/get.go +++ b/routes/get.go @@ -144,7 +144,8 @@ func GetCertificateInformationEncoded(c *gin.Context) { "validationType": validationType, "signatureAlgorithm": certificate.SignatureAlgorithm.String(), "publicKeyAlgorithm": certificate.PublicKeyAlgorithm.String(), - "serialNumber": certificate.SerialNumber.Int64(), + "serialNumber": certificate.SerialNumber.String(), + "notBefore": certificate.NotBefore, "notAfter": certificate.NotAfter, "keyUsage": keyUsages, "keyUsageAsText": keyUsagesText, @@ -183,6 +184,7 @@ func GetCertificateInfo(c *gin.Context) { tlsVersion = "unknown" } certificate := resp.ConnectionState().PeerCertificates[0] + rootCertificate := resp.ConnectionState().PeerCertificates[len(resp.ConnectionState().PeerCertificates)-1] var validationType string for _, value := range certificate.PolicyIdentifiers { @@ -285,10 +287,18 @@ func GetCertificateInfo(c *gin.Context) { "locality": certificate.Issuer.Locality, "country": certificate.Issuer.Country, }, + "root": gin.H{ + "commonName": rootCertificate.Issuer.CommonName, + "organization": rootCertificate.Issuer.Organization, + "organizationalUnit": rootCertificate.Issuer.OrganizationalUnit, + "locality": rootCertificate.Issuer.Locality, + "country": rootCertificate.Issuer.Country, + }, "validationType": validationType, "signatureAlgorithm": certificate.SignatureAlgorithm.String(), "publicKeyAlgorithm": certificate.PublicKeyAlgorithm.String(), - "serialNumber": certificate.SerialNumber.Int64(), + "serialNumber": certificate.SerialNumber.String(), + "notBefore": certificate.NotBefore, "notAfter": certificate.NotAfter, "keyUsage": keyUsages, "keyUsageAsText": keyUsagesText,