formatting

merge-requests/1/head
Matthew 2020-12-23 16:28:41 -05:00
parent af8d64cd35
commit 27732e63c1
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 20 additions and 20 deletions

View File

@ -87,39 +87,39 @@ func GetCertificateInfo(c *gin.Context) {
} }
} }
if certificate.KeyUsage & x509.KeyUsageCRLSign != 0 { if certificate.KeyUsage&x509.KeyUsageCRLSign != 0 {
keyUsages = append(keyUsages, 0) keyUsages = append(keyUsages, 0)
keyUsagesText = append(keyUsagesText, "CRL Signing") keyUsagesText = append(keyUsagesText, "CRL Signing")
} }
if certificate.KeyUsage & x509.KeyUsageCertSign != 0 { if certificate.KeyUsage&x509.KeyUsageCertSign != 0 {
keyUsages = append(keyUsages, 1) keyUsages = append(keyUsages, 1)
keyUsagesText = append(keyUsagesText, "Certificate Signing") keyUsagesText = append(keyUsagesText, "Certificate Signing")
} }
if certificate.KeyUsage & x509.KeyUsageContentCommitment != 0 { if certificate.KeyUsage&x509.KeyUsageContentCommitment != 0 {
keyUsages = append(keyUsages, 3) keyUsages = append(keyUsages, 3)
keyUsagesText = append(keyUsagesText, "Content Commitment") keyUsagesText = append(keyUsagesText, "Content Commitment")
} }
if certificate.KeyUsage & x509.KeyUsageDataEncipherment != 0 { if certificate.KeyUsage&x509.KeyUsageDataEncipherment != 0 {
keyUsages = append(keyUsages, 4) keyUsages = append(keyUsages, 4)
keyUsagesText = append(keyUsagesText, "Data Encipherment") keyUsagesText = append(keyUsagesText, "Data Encipherment")
} }
if certificate.KeyUsage & x509.KeyUsageDecipherOnly != 0 { if certificate.KeyUsage&x509.KeyUsageDecipherOnly != 0 {
keyUsages = append(keyUsages, 5) keyUsages = append(keyUsages, 5)
keyUsagesText = append(keyUsagesText, "Decipher Only") keyUsagesText = append(keyUsagesText, "Decipher Only")
} }
if certificate.KeyUsage & x509.KeyUsageDigitalSignature != 0 { if certificate.KeyUsage&x509.KeyUsageDigitalSignature != 0 {
keyUsages = append(keyUsages, 5) keyUsages = append(keyUsages, 5)
keyUsagesText = append(keyUsagesText, "Digital Signature") keyUsagesText = append(keyUsagesText, "Digital Signature")
} }
if certificate.KeyUsage & x509.KeyUsageEncipherOnly != 0 { if certificate.KeyUsage&x509.KeyUsageEncipherOnly != 0 {
keyUsages = append(keyUsages, 6) keyUsages = append(keyUsages, 6)
keyUsagesText = append(keyUsagesText, "Encipher Only") keyUsagesText = append(keyUsagesText, "Encipher Only")
} }
if certificate.KeyUsage & x509.KeyUsageKeyAgreement != 0 { if certificate.KeyUsage&x509.KeyUsageKeyAgreement != 0 {
keyUsages = append(keyUsages, 7) keyUsages = append(keyUsages, 7)
keyUsagesText = append(keyUsagesText, "Key Agreement") keyUsagesText = append(keyUsagesText, "Key Agreement")
} }
if certificate.KeyUsage & x509.KeyUsageKeyEncipherment != 0 { if certificate.KeyUsage&x509.KeyUsageKeyEncipherment != 0 {
keyUsages = append(keyUsages, 8) keyUsages = append(keyUsages, 8)
keyUsagesText = append(keyUsagesText, "Key Encipherment") keyUsagesText = append(keyUsagesText, "Key Encipherment")
} }
@ -142,19 +142,19 @@ func GetCertificateInfo(c *gin.Context) {
"locality": certificate.Issuer.Locality, "locality": certificate.Issuer.Locality,
"country": certificate.Issuer.Country, "country": certificate.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.Int64(),
"notAfter": certificate.NotAfter, "notAfter": certificate.NotAfter,
"keyUsage": keyUsages, "keyUsage": keyUsages,
"keyUsageAsText": keyUsagesText, "keyUsageAsText": keyUsagesText,
"extendedKeyUsage": extendedKeyUsages, "extendedKeyUsage": extendedKeyUsages,
"extendedKeyUsageAsText": extendedKeyUsagesText, "extendedKeyUsageAsText": extendedKeyUsagesText,
"san": certificate.DNSNames, "san": certificate.DNSNames,
"fingerprint": hex.EncodeToString(sum[:]), "fingerprint": hex.EncodeToString(sum[:]),
"connection": gin.H{ "connection": gin.H{
"tlsVersion": tlsVersion, "tlsVersion": tlsVersion,
"cipherSuite": cipherSuite, "cipherSuite": cipherSuite,
}, },
}) })