new changes

merge-requests/1/head
Matthew 2020-12-25 19:56:17 -05:00
parent 237e3d6b63
commit 3c63e473bd
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 12 additions and 2 deletions

View File

@ -144,7 +144,8 @@ func GetCertificateInformationEncoded(c *gin.Context) {
"validationType": validationType, "validationType": validationType,
"signatureAlgorithm": certificate.SignatureAlgorithm.String(), "signatureAlgorithm": certificate.SignatureAlgorithm.String(),
"publicKeyAlgorithm": certificate.PublicKeyAlgorithm.String(), "publicKeyAlgorithm": certificate.PublicKeyAlgorithm.String(),
"serialNumber": certificate.SerialNumber.Int64(), "serialNumber": certificate.SerialNumber.String(),
"notBefore": certificate.NotBefore,
"notAfter": certificate.NotAfter, "notAfter": certificate.NotAfter,
"keyUsage": keyUsages, "keyUsage": keyUsages,
"keyUsageAsText": keyUsagesText, "keyUsageAsText": keyUsagesText,
@ -183,6 +184,7 @@ func GetCertificateInfo(c *gin.Context) {
tlsVersion = "unknown" tlsVersion = "unknown"
} }
certificate := resp.ConnectionState().PeerCertificates[0] certificate := resp.ConnectionState().PeerCertificates[0]
rootCertificate := resp.ConnectionState().PeerCertificates[len(resp.ConnectionState().PeerCertificates)-1]
var validationType string var validationType string
for _, value := range certificate.PolicyIdentifiers { for _, value := range certificate.PolicyIdentifiers {
@ -285,10 +287,18 @@ func GetCertificateInfo(c *gin.Context) {
"locality": certificate.Issuer.Locality, "locality": certificate.Issuer.Locality,
"country": certificate.Issuer.Country, "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, "validationType": validationType,
"signatureAlgorithm": certificate.SignatureAlgorithm.String(), "signatureAlgorithm": certificate.SignatureAlgorithm.String(),
"publicKeyAlgorithm": certificate.PublicKeyAlgorithm.String(), "publicKeyAlgorithm": certificate.PublicKeyAlgorithm.String(),
"serialNumber": certificate.SerialNumber.Int64(), "serialNumber": certificate.SerialNumber.String(),
"notBefore": certificate.NotBefore,
"notAfter": certificate.NotAfter, "notAfter": certificate.NotAfter,
"keyUsage": keyUsages, "keyUsage": keyUsages,
"keyUsageAsText": keyUsagesText, "keyUsageAsText": keyUsagesText,