Golang crypto/x509.Certificate.CheckSignature() function example
package crypto/x509
CheckSignature verifies that signature is a valid signature over signed from the given certificate's public key.
Golang crypto/x509.Certificate.CheckSignature() function usage
var signature []byte
err = cert.CheckSignature(x509.SHA256WithRSA, []byte(signingString), signature)
if err != nil {
fmt.Println("Key is not a valid RSA public key")
os.Exit(1)
}
or
if err := x509.CheckSignature(cert.SignatureAlgorithm, cert.RawTBSCertificate, cert.Signature); err != nil {
fmt.Println("Corrupted signature on embedded certificate")
}
Reference :
http://golang.org/pkg/crypto/x509/#Certificate.CheckSignature
Advertisement
Something interesting
Tutorials
+11.6k Golang : Surveillance with web camera and OpenCV
+5.6k Golang : Shortening import identifier
+22.1k Golang : Match strings by wildcard patterns with filepath.Match() function
+8.3k Useful methods to access blocked websites
+7.1k Javascript : How to get JSON data from another website with JQuery or Ajax ?
+5.6k Swift : Get substring with rangeOfString() function example
+12.2k Golang : Get remaining text such as id or filename after last segment in URL path
+18.4k Golang : Read binary file into memory
+16k Golang : Get sub string example
+10.8k Android Studio : Checkbox for user to select options example
+10.3k Golang : How to check if a website is served via HTTPS
+23.5k Golang : Check if element exist in map