示例#1
0
// UsePrivateKey configures the context to use the given private key for SSL
// handshakes.
func (c *Ctx) UsePrivateKey(key PrivateKey) error {
	runtime.LockOSThread()
	defer runtime.UnlockOSThread()
	if int(C.SSL_CTX_use_PrivateKey(c.ctx, key.evpPKey())) != 1 {
		return errorFromErrorQueue()
	}
	return nil
}
示例#2
0
文件: context.go 项目: postfix/go-ssl
func (self *Context) UsePrivateKey(key *evp.PKey) error {
	if int(C.SSL_CTX_use_PrivateKey(self.Ctx, (*C.EVP_PKEY)(unsafe.Pointer(key.PKey)))) != 1 {
		return errors.New("problem loading key " + sslerr.SSLErrorMessage())
	}
	return nil
}