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
+7.4k Linux : How to fix Brother HL-1110 printing blank page problem
+14.4k Golang : Recombine chunked files example
+6.7k Golang : Experimental emojis or emoticons icons programming language
+9.4k Golang : Find the length of big.Int variable example
+13.6k Android Studio : Password input and reveal password example
+14.6k Golang : GUI with Qt and OpenCV to capture image from camera
+12.2k Linux : How to install driver for 600Mbps Dual Band Wifi USB Adapter
+21.8k SSL : How to check if current certificate is sha1 or sha2
+17.5k Golang : Clone with pointer and modify value
+22.4k Golang : How to read JPG(JPEG), GIF and PNG files ?
+30.9k Golang : Interpolating or substituting variables in string examples