예제 #1
0
파일: attribute.go 프로젝트: postfix/sspi
func (c *Client) KeyInfo() (sessionKeySize uint32, sigAlg uint32, sigAlgName string, encAlg uint32, encAlgName string, err error) {
	var ki _SecPkgContext_KeyInfo
	ret := sspi.QueryContextAttributes(c.ctx.Handle, _SECPKG_ATTR_KEY_INFO, (*byte)(unsafe.Pointer(&ki)))
	if ret != sspi.SEC_E_OK {
		return 0, 0, "", 0, "", ret
	}
	defer sspi.FreeContextBuffer((*byte)(unsafe.Pointer(ki.SignatureAlgorithmName)))
	defer sspi.FreeContextBuffer((*byte)(unsafe.Pointer(ki.EncryptAlgorithmName)))
	saname := syscall.UTF16ToString((*[2 << 20]uint16)(unsafe.Pointer(ki.SignatureAlgorithmName))[:])
	eaname := syscall.UTF16ToString((*[2 << 20]uint16)(unsafe.Pointer(ki.EncryptAlgorithmName))[:])
	return ki.KeySize, ki.SignatureAlgorithm, saname, ki.EncryptAlgorithm, eaname, nil
}
예제 #2
0
파일: attribute.go 프로젝트: postfix/sspi
func (c *Client) UserName() (string, error) {
	var ns _SecPkgContext_Names
	ret := sspi.QueryContextAttributes(c.ctx.Handle, _SECPKG_ATTR_NAMES, (*byte)(unsafe.Pointer(&ns)))
	if ret != sspi.SEC_E_OK {
		return "", ret
	}
	defer sspi.FreeContextBuffer((*byte)(unsafe.Pointer(ns.UserName)))
	s := syscall.UTF16ToString((*[2 << 20]uint16)(unsafe.Pointer(ns.UserName))[:])
	return s, nil
}
예제 #3
0
파일: attribute.go 프로젝트: postfix/sspi
func (c *Client) AuthorityName() (string, error) {
	var a _SecPkgContext_Authority
	ret := sspi.QueryContextAttributes(c.ctx.Handle, _SECPKG_ATTR_AUTHORITY, (*byte)(unsafe.Pointer(&a)))
	if ret != sspi.SEC_E_OK {
		return "", ret
	}
	defer sspi.FreeContextBuffer((*byte)(unsafe.Pointer(a.AuthorityName)))
	s := syscall.UTF16ToString((*[2 << 20]uint16)(unsafe.Pointer(a.AuthorityName))[:])
	return s, nil
}
예제 #4
0
파일: attribute.go 프로젝트: postfix/sspi
func (c *Client) ProtocolInfo() (name string, major, minor uint32, err error) {
	var pi _SecPkgContext_ProtoInfo
	ret := sspi.QueryContextAttributes(c.ctx.Handle, _SECPKG_ATTR_PROTO_INFO, (*byte)(unsafe.Pointer(&pi)))
	if ret != sspi.SEC_E_OK {
		return "", 0, 0, ret
	}
	defer sspi.FreeContextBuffer((*byte)(unsafe.Pointer(pi.ProtocolName)))
	s := syscall.UTF16ToString((*[2 << 20]uint16)(unsafe.Pointer(pi.ProtocolName))[:])
	return s, pi.MajorVersion, pi.MinorVersion, nil
}