From 95195f1214912085bd3fa35706f53d406829016b Mon Sep 17 00:00:00 2001 From: antiduh Date: Wed, 25 Jun 2014 02:49:25 +0000 Subject: [PATCH] Working on implementing impersonation. --- Contexts/ContextNativeMethods.cs | 10 ++++++++++ NSspi.csproj | 1 + 2 files changed, 11 insertions(+) diff --git a/Contexts/ContextNativeMethods.cs b/Contexts/ContextNativeMethods.cs index 6ddcf6c..bff36a9 100644 --- a/Contexts/ContextNativeMethods.cs +++ b/Contexts/ContextNativeMethods.cs @@ -146,6 +146,16 @@ namespace NSspi.Contexts [DllImport( "Secur32.dll", EntryPoint = "FreeContextBuffer", CharSet = CharSet.Unicode )] internal static extern SecurityStatus FreeContextBuffer( IntPtr handle ); + + [ReliabilityContract( Consistency.WillNotCorruptState, Cer.Success )] + [DllImport( "Secur32.dll", EntryPoint = "ImpersonateSecurityContext ", CharSet = CharSet.Unicode )] + internal static extern SecurityStatus ImpersonateSecurityContext( ref RawSspiHandle contextHandle ); + + [ReliabilityContract( Consistency.WillNotCorruptState, Cer.Success )] + [DllImport( "Secur32.dll", EntryPoint = "RevertSecurityContext ", CharSet = CharSet.Unicode )] + internal static extern SecurityStatus RevertSecurityContext( ref RawSspiHandle contextHandle ); + + internal static SecurityStatus SafeEncryptMessage( SafeContextHandle handle, int qualityOfProtection, diff --git a/NSspi.csproj b/NSspi.csproj index 45db057..10cd6c5 100644 --- a/NSspi.csproj +++ b/NSspi.csproj @@ -53,6 +53,7 @@ +