Ejemplo n.º 1
0
        public unsafe static SecurityStatus SafeAcceptSecurityContext(ref SafeCredHandle credential, ref SafeCtxtHandle context, ref SecBufferDescEx input, int contextReq, TargetDataRep targetDataRep, ref SafeCtxtHandle newContext, ref SecBufferDescEx output, out int contextAttr, out long timeStamp)
        {
            SecurityStatus result;

            try
            {
                input.Pin();
                output.Pin();
                try
                {
                    fixed(IntPtr *ptr = (IntPtr *)(&context.Handle))
                    {
                        int error = Secur32Dll.AcceptSecurityContext(ref credential.Handle, context.IsInvalid ? null : ((void *)ptr), ref input.SecBufferDesc, contextReq, (int)targetDataRep, ref newContext.Handle, ref output.SecBufferDesc, out contextAttr, out timeStamp);

                        result = Sspi.Convert(error);
                    }
                }
                finally
                {
                    IntPtr *ptr = null;
                }
            }
            catch
            {
                contextAttr = 0;
                timeStamp   = 0L;
                result      = (SecurityStatus)4294967295u;
            }
            finally
            {
                input.Free();
                output.Free();
            }
            return(result);
        }
Ejemplo n.º 2
0
        public unsafe static SecurityStatus SafeQueryContextAttributes(ref SafeCtxtHandle context, UlAttribute attribute, void *buffer)
        {
            SecurityStatus result;

            try
            {
                int error = Secur32Dll.QueryContextAttributesA(ref context.Handle, (uint)attribute, buffer);
                result = Sspi.Convert(error);
            }
            catch
            {
                result = (SecurityStatus)4294967295u;
            }
            return(result);
        }
Ejemplo n.º 3
0
        public static SecurityStatus SafeMakeSignature(SafeCtxtHandle context, ref SecBufferDescEx message, int sequence)
        {
            SecurityStatus result;

            try
            {
                message.Pin();
                int error = Secur32Dll.MakeSignature(ref context.Handle, 0, ref message.SecBufferDesc, sequence);
                result = Sspi.Convert(error);
            }
            catch
            {
                result = (SecurityStatus)4294967295u;
            }
            finally
            {
                message.Free();
            }
            return(result);
        }
Ejemplo n.º 4
0
        public unsafe static SecurityStatus SafeDecryptMessage(ref SafeCtxtHandle context, ref SecBufferDescEx message, uint MessageSeqNo, void *pfQOP)
        {
            SecurityStatus result;

            try
            {
                message.Pin();
                int error = Secur32Dll.DecryptMessage(ref context.Handle, ref message.SecBufferDesc, MessageSeqNo, pfQOP);
                result = Sspi.Convert(error);
            }
            catch
            {
                result = (SecurityStatus)4294967295u;
            }
            finally
            {
                message.Free();
            }
            return(result);
        }
Ejemplo n.º 5
0
 public static SecurityStatus EnumerateSecurityPackages(out int packages, out SafeContextBufferHandle secPkgInfos)
 {
     return(Sspi.Convert(Secur32Dll.EnumerateSecurityPackagesA(out packages, out secPkgInfos)));
 }