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
+13k Swift : Convert (cast) Int to String ?
+9.5k Mac OSX : Get a process/daemon status information
+21.2k Golang : How to get time zone and load different time zone?
+19.8k Golang : Append content to a file
+22.2k Golang : Securing password with salt
+5.4k Gogland : Datasource explorer
+31.6k Golang : Get local IP and MAC address
+5.3k PHP : Hide PHP version information from curl
+8.6k Golang : Convert(cast) []byte to io.Reader type
+18.7k Golang : Implement getters and setters
+19.3k Golang : Calculate entire request body length during run time
+13.1k Golang : Handle or parse date string with Z suffix(RFC3339) example