Golang crypto/x509.SignatureAlgorithm type example
package crypto/x509
Golang crypto/x509.SignatureAlgorithm type usage examples
if err := x509.CheckSignature(cert.SignatureAlgorithm, cert.RawTBSCertificate, cert.Signature); err != nil {
fmt.Println("Corrupted signature on embedded certificate")
}
or
switch {
case x509Cert.SignatureAlgorithm == x509.MD2WithRSA:
return "MD2WithRSA Algorithm"
case x509Cert.SignatureAlgorithm == x509.MD5WithRSA:
return "MD5WithRSA Algorithm"
case x509Cert.SignatureAlgorithm == x509.SHA1WithRSA:
return "SHA1WithRSA Algorithm"
case x509Cert.SignatureAlgorithm == x509.SHA256WithRSA:
return "SHA256WithRSA Algorithm"
case x509Cert.SignatureAlgorithm == x509.SHA384WithRSA:
return "SHA384WithRSA Algorithm"
case x509Cert.SignatureAlgorithm == x509.SHA512WithRSA:
return "SHA512WithRSA Algorithm"
case x509Cert.SignatureAlgorithm == x509.DSAWithSHA1:
return "DSAWithSHA1 Algorithm"
case x509Cert.SignatureAlgorithm == x509.DSAWithSHA256:
return "DSAWithSHA256 Algorithm"
case x509Cert.SignatureAlgorithm == x509.ECDSAWithSHA1:
return "ECDSAWithSHA1 Algorithm"
case x509Cert.SignatureAlgorithm == x509.ECDSAWithSHA256:
return "ECDSAWithSHA256 Algorithm"
case x509Cert.SignatureAlgorithm == x509.ECDSAWithSHA384:
return "ECDSAWithSHA384 Algorithm"
case x509Cert.SignatureAlgorithm == x509.ECDSAWithSHA512:
return "ECDSAWithSHA512 Algorithm"
default:
return "UnknownSignatureAlgorithm"
}
Reference :
Advertisement
Something interesting
Tutorials
+6.9k How to let Facebook Login button redirect to a particular URL ?
+9k Golang : Inject/embed Javascript before sending out to browser example
+7.7k Golang : How to execute code at certain day, hour and minute?
+10k Golang : Read file and convert content to string
+7.5k Gogland : Single File versus Go Application Run Configurations
+5.9k Golang : Shuffle array of list
+21.8k SSL : How to check if current certificate is sha1 or sha2
+9.1k Golang : Intercept and compare HTTP response code example
+16.6k Golang : Delete files by extension
+5.1k Linux/Unix/MacOSX : Find out which application is listening to port 80 or use which IP version
+10.6k Golang : How to delete element(data) from map ?
+9.2k Golang : How to find out similarity between two strings with Jaro-Winkler Distance?