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
+20.2k Golang : Convert seconds to human readable time format example
+36.7k Golang : Display float in 2 decimal points and rounding up or down
+5.4k Golang : Intercept, inject and replay HTTP traffics from web server
+10.2k Golang : Bcrypting password
+17.1k Golang : XML to JSON example
+8.3k Golang: Prevent over writing file with md5 hash
+11.8k Golang : GTK Input dialog box examples
+5.6k PHP : Convert CSV to JSON with YQL example
+15.8k Golang : Get digits from integer before and after given position example
+9.3k Golang : How to get ECDSA curve and parameters data?
+6.6k Golang : Warp text string by number of characters or runes example