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
+8.2k Golang : HttpRouter multiplexer routing example
+15.6k Golang : Validate hostname
+14.2k Elastic Search : Mapping date format and sort by date
+19.5k Golang : Example for DSA(Digital Signature Algorithm) package functions
+7.1k Restart Apache or Nginx web server without password prompt
+17.1k Golang : Capture stdout of a child process and act according to the result
+5.2k Golang : Experimental Jawi programming language
+8.8k Golang : Gorilla web tool kit schema example
+17.9k Golang : Simple client server example
+10.2k Golang : Bcrypting password
+35.9k Golang : Integer is between a range
+17.8k Golang : Iterate linked list example