コード例 #1
0
ファイル: Secur32.cs プロジェクト: vf1/serversockets
        public unsafe static void EncryptMessage(
            ref SafeCtxtHandle context,
            ref SecBufferDescEx message,
            uint MessageSeqNo,
            void *pfQOP)
        {
            try
            {
                message.Pin();

                int error = Secur32Dll.EncryptMessage(
                    ref context.Handle,
                    pfQOP,
                    ref message.SecBufferDesc,
                    MessageSeqNo);

                if (error != 0)
                {
                    throw new SspiException(error, @"EncryptMessage");
                }
            }
            finally
            {
                message.Free();
            }
        }
コード例 #2
0
ファイル: Secur32.cs プロジェクト: vf1/serversockets
        public unsafe static SecurityStatus SafeVerifySignature(
            SafeCtxtHandle context,
            ref SecBufferDescEx message,
            int sequence)
        {
            try
            {
                message.Pin();

                int qop;

                var error = Secur32Dll.VerifySignature(
                    ref context.Handle,
                    ref message.SecBufferDesc,
                    sequence,
                    out qop);

                return(Convert(error));
            }
            catch
            {
                return(SecurityStatus.SEC_E_UNKNOW_ERROR);
            }
            finally
            {
                message.Free();
            }
        }
コード例 #3
0
ファイル: Secur32.cs プロジェクト: vf1/serversockets
        public unsafe static SecurityStatus SafeDecryptMessage(
            ref SafeCtxtHandle context,
            ref SecBufferDescEx message,
            uint MessageSeqNo,
            void *pfQOP)
        {
            try
            {
                message.Pin();

                int error = Secur32Dll.DecryptMessage(
                    ref context.Handle,
                    ref message.SecBufferDesc,
                    MessageSeqNo,
                    pfQOP);

                return(Convert(error));
            }
            catch
            {
                return(SecurityStatus.SEC_E_UNKNOW_ERROR);
            }
            finally
            {
                message.Free();
            }
        }
コード例 #4
0
ファイル: Secur32.cs プロジェクト: vf1/serversockets
        public static unsafe 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)
        {
            try
            {
                input.Pin();
                output.Pin();

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

                    return(Convert(error));
                }
            }
            catch
            {
                contextAttr = 0;
                timeStamp   = 0;
                return(SecurityStatus.SEC_E_UNKNOW_ERROR);
            }
            finally
            {
                input.Free();
                output.Free();
            }
        }
コード例 #5
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);
        }
コード例 #6
0
ファイル: Secur32.cs プロジェクト: vf1/serversockets
        public static unsafe SecurityStatus SafeAcceptSecurityContext(
            ref SafeCredHandle credential,
            ref SafeCtxtHandle context,
            ref SecBufferDescEx input,
            int contextReq,
            TargetDataRep targetDataRep,
            ref SafeCtxtHandle newContext,
            ref SecBufferDescEx output)
        {
            int  contextAttr;
            long timeStamp;

            return(SafeAcceptSecurityContext(
                       ref credential,
                       ref context,
                       ref input,
                       contextReq,
                       targetDataRep,
                       ref newContext,
                       ref output,
                       out contextAttr,
                       out timeStamp));
        }
コード例 #7
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);
        }
コード例 #8
0
        public static SecurityStatus SafeAcceptSecurityContext(ref SafeCredHandle credential, ref SafeCtxtHandle context, ref SecBufferDescEx input, int contextReq, TargetDataRep targetDataRep, ref SafeCtxtHandle newContext, ref SecBufferDescEx output)
        {
            int  num;
            long num2;

            return(Sspi.SafeAcceptSecurityContext(ref credential, ref context, ref input, contextReq, targetDataRep, ref newContext, ref output, out num, out num2));
        }
コード例 #9
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);
        }