From 1be2b9c7efc515813a926693b187fd56304b9e10 Mon Sep 17 00:00:00 2001 From: antiduh Date: Mon, 23 Jun 2014 02:34:36 +0000 Subject: [PATCH] Saving work.. working on implementing EncryptMessage. The buffer types and allocation that get passed to the call is really crazy in the sample. --- Contexts/Context.cs | 4 ++++ Contexts/ContextNativeMethods.cs | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/Contexts/Context.cs b/Contexts/Context.cs index 89e4aa1..f5e5cd3 100644 --- a/Contexts/Context.cs +++ b/Contexts/Context.cs @@ -49,5 +49,9 @@ namespace NSspi this.disposed = true; } + + public byte[] Encrypt( byte[] input ) + { + } } } diff --git a/Contexts/ContextNativeMethods.cs b/Contexts/ContextNativeMethods.cs index 32fb3ed..913f53b 100644 --- a/Contexts/ContextNativeMethods.cs +++ b/Contexts/ContextNativeMethods.cs @@ -148,5 +148,19 @@ namespace NSspi.Contexts SetLastError = true )] public static extern SecurityStatus DeleteSecurityContext( ref long contextHandle ); + + [DllImport( + "Secur32.dll", + EntryPoint = "EncryptMessag", + CallingConvention = CallingConvention.Winapi, + CharSet = CharSet.Unicode, + SetLastError = true + )] + public static extern SecurityStatus EncryptMessage( + ref long contextHandle, + int qualityOfProtection, + IntPtr bufferDescriptor, + int sequenceNumber + ); } }