예제 #1
0
파일: context.go 프로젝트: postfix/go-ssl
func (self *Context) UseCertificate(cert *Certificate) error {

	if int(C.SSL_CTX_use_certificate(self.Ctx, (*C.X509)(unsafe.Pointer(cert.X509)))) != 1 {
		return errors.New("problem loading cert " + sslerr.SSLErrorMessage())
	}
	return nil
}
예제 #2
0
// UseCertificate configures the context to present the given certificate to
// peers.
func (c *Ctx) UseCertificate(cert *Certificate) error {
	runtime.LockOSThread()
	defer runtime.UnlockOSThread()
	if int(C.SSL_CTX_use_certificate(c.ctx, cert.x)) != 1 {
		return errorFromErrorQueue()
	}
	return nil
}