Exemplo n.º 1
0
        public unsafe int QueryContextAttributes(SafeDeleteContext context, Interop.SspiCli.ContextAttribute attribute, Span <byte> buffer, Type?handleType, out SafeHandle?refHandle)
        {
            refHandle = null;
            if (handleType != null)
            {
                if (handleType == typeof(SafeFreeContextBuffer))
                {
                    refHandle = SafeFreeContextBuffer.CreateEmptyHandle();
                }
                else if (handleType == typeof(SafeFreeCertContext))
                {
                    refHandle = new SafeFreeCertContext();
                }
                else
                {
                    throw new ArgumentException(SR.Format(SR.SSPIInvalidHandleType, handleType.FullName), nameof(handleType));
                }
            }

            fixed(byte *bufferPtr = buffer)
            {
                return(SafeFreeContextBuffer.QueryContextAttributes(context, attribute, bufferPtr, refHandle));
            }
        }
Exemplo n.º 2
0
        public unsafe int QueryContextAttributes(SafeDeleteContext context, ContextAttribute attribute, byte[] buffer, Type handleType, out SafeHandle refHandle)
        {
            refHandle = null;
            if (handleType != null)
            {
                if (handleType == typeof(SafeFreeContextBuffer))
                {
                    refHandle = SafeFreeContextBuffer.CreateEmptyHandle(Library);
                }
                else if (handleType == typeof(SafeFreeCertContext))
                {
                    refHandle = new SafeFreeCertContext();
                }
                else
                {
                    throw new ArgumentException(SR.GetString(SR.SSPIInvalidHandleType, handleType.FullName), "handleType");
                }
            }

            fixed(byte *bufferPtr = buffer)
            {
                return(SafeFreeContextBuffer.QueryContextAttributes(Library, context, attribute, bufferPtr, refHandle));
            }
        }
Exemplo n.º 3
0
        private unsafe int QueryContextAttributes(SafeDeleteContext phContext, Interop.Secur32.ContextAttribute attribute, byte[] buffer, Type handleType, out SafeHandle refHandle)
        {
            refHandle = null;
            if (handleType != null)
            {
                if (handleType == typeof(SafeFreeContextBuffer))
                {
                    refHandle = SafeFreeContextBuffer.CreateEmptyHandle();
                }
                else if (handleType == typeof(SafeFreeCertContext))
                {
                    refHandle = new SafeFreeCertContext();
                }
                else
                {
                    throw new ArgumentException(SR.Format(SR.SSPIInvalidHandleType, handleType.FullName), "handleType");
                }
            }

            fixed(byte *bufferPtr = buffer)
            {
                return(SafeFreeContextBuffer.QueryContextAttributes(phContext, attribute, bufferPtr, refHandle));
            }
        }
Exemplo n.º 4
0
        public unsafe int QueryContextAttributes(SafeDeleteContext phContext, ContextAttribute attribute, byte[] buffer, Type handleType, out SafeHandle refHandle)
        {
            refHandle = null;
            if (handleType != null)
            {
                if (handleType != typeof(SafeFreeContextBuffer))
                {
                    if (handleType != typeof(SafeFreeCertContext))
                    {
                        throw new ArgumentException(SR.GetString("SSPIInvalidHandleType", new object[] { handleType.FullName }), "handleType");
                    }
                    refHandle = new SafeFreeCertContext();
                }
                else
                {
                    refHandle = SafeFreeContextBuffer.CreateEmptyHandle(Library);
                }
            }

            fixed(byte *numRef = buffer)
            {
                return(SafeFreeContextBuffer.QueryContextAttributes(Library, phContext, attribute, numRef, refHandle));
            }
        }