formatting
parent
af8d64cd35
commit
27732e63c1
|
@ -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)
|
||||
keyUsagesText = append(keyUsagesText, "CRL Signing")
|
||||
}
|
||||
if certificate.KeyUsage & x509.KeyUsageCertSign != 0 {
|
||||
if certificate.KeyUsage&x509.KeyUsageCertSign != 0 {
|
||||
keyUsages = append(keyUsages, 1)
|
||||
keyUsagesText = append(keyUsagesText, "Certificate Signing")
|
||||
}
|
||||
if certificate.KeyUsage & x509.KeyUsageContentCommitment != 0 {
|
||||
if certificate.KeyUsage&x509.KeyUsageContentCommitment != 0 {
|
||||
keyUsages = append(keyUsages, 3)
|
||||
keyUsagesText = append(keyUsagesText, "Content Commitment")
|
||||
}
|
||||
if certificate.KeyUsage & x509.KeyUsageDataEncipherment != 0 {
|
||||
if certificate.KeyUsage&x509.KeyUsageDataEncipherment != 0 {
|
||||
keyUsages = append(keyUsages, 4)
|
||||
keyUsagesText = append(keyUsagesText, "Data Encipherment")
|
||||
}
|
||||
if certificate.KeyUsage & x509.KeyUsageDecipherOnly != 0 {
|
||||
if certificate.KeyUsage&x509.KeyUsageDecipherOnly != 0 {
|
||||
keyUsages = append(keyUsages, 5)
|
||||
keyUsagesText = append(keyUsagesText, "Decipher Only")
|
||||
}
|
||||
if certificate.KeyUsage & x509.KeyUsageDigitalSignature != 0 {
|
||||
if certificate.KeyUsage&x509.KeyUsageDigitalSignature != 0 {
|
||||
keyUsages = append(keyUsages, 5)
|
||||
keyUsagesText = append(keyUsagesText, "Digital Signature")
|
||||
}
|
||||
if certificate.KeyUsage & x509.KeyUsageEncipherOnly != 0 {
|
||||
if certificate.KeyUsage&x509.KeyUsageEncipherOnly != 0 {
|
||||
keyUsages = append(keyUsages, 6)
|
||||
keyUsagesText = append(keyUsagesText, "Encipher Only")
|
||||
}
|
||||
if certificate.KeyUsage & x509.KeyUsageKeyAgreement != 0 {
|
||||
if certificate.KeyUsage&x509.KeyUsageKeyAgreement != 0 {
|
||||
keyUsages = append(keyUsages, 7)
|
||||
keyUsagesText = append(keyUsagesText, "Key Agreement")
|
||||
}
|
||||
if certificate.KeyUsage & x509.KeyUsageKeyEncipherment != 0 {
|
||||
if certificate.KeyUsage&x509.KeyUsageKeyEncipherment != 0 {
|
||||
keyUsages = append(keyUsages, 8)
|
||||
keyUsagesText = append(keyUsagesText, "Key Encipherment")
|
||||
}
|
||||
|
@ -142,19 +142,19 @@ func GetCertificateInfo(c *gin.Context) {
|
|||
"locality": certificate.Issuer.Locality,
|
||||
"country": certificate.Issuer.Country,
|
||||
},
|
||||
"validationType": validationType,
|
||||
"signatureAlgorithm": certificate.SignatureAlgorithm.String(),
|
||||
"publicKeyAlgorithm": certificate.PublicKeyAlgorithm.String(),
|
||||
"serialNumber": certificate.SerialNumber.Int64(),
|
||||
"notAfter": certificate.NotAfter,
|
||||
"keyUsage": keyUsages,
|
||||
"keyUsageAsText": keyUsagesText,
|
||||
"extendedKeyUsage": extendedKeyUsages,
|
||||
"validationType": validationType,
|
||||
"signatureAlgorithm": certificate.SignatureAlgorithm.String(),
|
||||
"publicKeyAlgorithm": certificate.PublicKeyAlgorithm.String(),
|
||||
"serialNumber": certificate.SerialNumber.Int64(),
|
||||
"notAfter": certificate.NotAfter,
|
||||
"keyUsage": keyUsages,
|
||||
"keyUsageAsText": keyUsagesText,
|
||||
"extendedKeyUsage": extendedKeyUsages,
|
||||
"extendedKeyUsageAsText": extendedKeyUsagesText,
|
||||
"san": certificate.DNSNames,
|
||||
"fingerprint": hex.EncodeToString(sum[:]),
|
||||
"san": certificate.DNSNames,
|
||||
"fingerprint": hex.EncodeToString(sum[:]),
|
||||
"connection": gin.H{
|
||||
"tlsVersion": tlsVersion,
|
||||
"tlsVersion": tlsVersion,
|
||||
"cipherSuite": cipherSuite,
|
||||
},
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue