Example #1
0
func (self *CertificateStoreCtx) Err() error {
	code := C.X509_STORE_CTX_get_error(self.ctx)
	if code == C.X509_V_OK {
		return nil
	}
	return fmt.Errorf("openssl: %s",
		C.GoString(C.X509_verify_cert_error_string(C.long(code))))
}
Example #2
0
// GetVerifyResult gets result of peer certificate verification
// SSL_get_verify_result() returns the result of the verification of the X509
// certificate presented by the peer, if any. See
// https://www.openssl.org/docs/ssl/SSL_get_verify_result.html
func (c *Conn) GetVerifyResults() error {
	result := C.SSL_get_verify_result(c.ssl)
	if int(result) != 0 {
		return errors.New(C.GoString(
			C.X509_verify_cert_error_string(result)))
	}
	return nil
}