protected virtual SECURITY_HANDLE AcquireCredential() { IntPtr pAuthData = IntPtr.Zero; SECURITY_HANDLE phCredential = default(SECURITY_HANDLE); var result = AcquireCredentialsHandle_0( null, Mechanism, SECPKG_CRED_INBOUND, IntPtr.Zero, ref pAuthData, IntPtr.Zero, IntPtr.Zero, ref phCredential, IntPtr.Zero ); if (result < 0) { var ex = new Win32Exception(result); throw ex; } return(phCredential); }
public static uint InitializeSecurityContext( ref SECURITY_HANDLE phCredential, //PCredHandle ref SECURITY_HANDLE phContext, //PCtxtHandle string pszTargetName, int fContextReq, int Reserved1, int TargetDataRep, ref SecBufferDesc SecBufferDesc, //PSecBufferDesc SecBufferDesc int Reserved2, out SECURITY_HANDLE phNewContext, //PCtxtHandle out SecBufferDesc pOutput, //PSecBufferDesc SecBufferDesc out uint pfContextAttr, //managed ulong == 64 bits!!! out SECURITY_INTEGER ptsExpiry) //PTimeStamp { NotImplemented(MethodBase.GetCurrentMethod()); phNewContext = new SECURITY_HANDLE { }; pOutput = new SecBufferDesc { }; pfContextAttr = 0; ptsExpiry = new SECURITY_INTEGER { }; return(0); }
private void CloseClientCredentials() { if (!(clientCredentials.HighPart == IntPtr.Zero && clientCredentials.LowPart == IntPtr.Zero)) { FreeCredentialsHandle(ref clientCredentials); clientCredentials = new SECURITY_HANDLE(0); } }
public static int MakeSignature(ref SECURITY_HANDLE phContext, // Context to use uint fQOP, // Quality of Protection ref SecBufferDesc pMessage, // Message to sign uint MessageSeqNo) // Message Sequence Num. { NotImplemented(MethodBase.GetCurrentMethod()); return(0); }
public static int EncryptMessage(ref SECURITY_HANDLE phContext, uint fQOP, //managed ulong == 64 bits!!! ref SecBufferDesc pMessage, uint MessageSeqNo) //managed ulong == 64 bits!!! { NotImplemented(MethodBase.GetCurrentMethod()); return(0); }
private void CloseClientContext() { if (!(clientContext.HighPart == IntPtr.Zero && clientContext.LowPart == IntPtr.Zero)) { DeleteSecurityContext(ref clientContext); clientContext = new SECURITY_HANDLE(0); } }
public static int VerifySignature(ref SECURITY_HANDLE phContext, // Context to use ref SecBufferDesc pMessage, // Message to sign uint MessageSeqNo, // Message Sequence Num. out uint pfQOP) // Quality of Protection { NotImplemented(MethodBase.GetCurrentMethod()); pfQOP = 0; return(0); }
public static int DecryptMessage(ref SECURITY_HANDLE phContext, ref SecBufferDesc pMessage, uint MessageSeqNo, out uint pfQOP) { NotImplemented(MethodBase.GetCurrentMethod()); pfQOP = 0; return(0); }
public static int QueryContextAttributes(ref SECURITY_HANDLE phContext, uint ulAttribute, out SecPkgContext_Sizes pContextAttributes) { NotImplemented(MethodBase.GetCurrentMethod()); pContextAttributes = new SecPkgContext_Sizes { }; return(0); }
public static extern int AcceptSecurityContext(ref SECURITY_HANDLE phCredential, ref SECURITY_HANDLE phContext, ref SecBufferDesc pInput, uint fContextReq, uint TargetDataRep, out SECURITY_HANDLE phNewContext, out SecBufferDesc pOutput, out uint pfContextAttr, //managed ulong == 64 bits!!! out SECURITY_INTEGER ptsTimeStamp);
internal static extern uint AcquireCredentialsHandle( IntPtr pszPrincipal, string pszPackage, int fCredentialUse, IntPtr PAuthenticationID, IntPtr pAuthData, int pGetKeyFn, IntPtr pvGetKeyArgument, ref SECURITY_HANDLE phCredential, ref SecurityPackages.SECURITY_INTEGER ptsExpiry);
internal static extern uint AcceptSecurityContext( ref SECURITY_HANDLE phCredential, IntPtr phContext, ref SecBufferDesc pInput, uint fContextReq, uint TargetDataRep, out SECURITY_HANDLE phNewContext, out SecBufferDesc pOutput, out uint pfContextAttr, out SecurityPackages.SECURITY_INTEGER ptsTimeStamp);
public static extern int AcquireCredentialsHandle( System.IntPtr pszPrincipal, //SEC_CHAR* string pszPackage, //SEC_CHAR* //"Kerberos","NTLM","Negotiative" int fCredentialUse, IntPtr PAuthenticationID, //_LUID AuthenticationID,//pvLogonID, //PLUID ref AuthIdentityEx pAuthData, //PVOID int pGetKeyFn, //SEC_GET_KEY_FN IntPtr pvGetKeyArgument, //PVOID ref SECURITY_HANDLE phCredential, //SecHandle //PCtxtHandle ref ref SECURITY_INTEGER ptsExpiry); //PTimeStamp //TimeStamp ref
internal static extern SecStatus AcceptSecurityContext_1( ref SECURITY_HANDLE phCredential, ref SECURITY_HANDLE phContext, ref SecBufferDesc pInput, ContextFlag fContextReq, uint TargetDataRep, ref SECURITY_HANDLE phNewContext, out SecBufferDesc pOutput, out ContextFlag pfContextAttr, out SECURITY_INTEGER ptsTimeStamp );
internal static extern int AcceptSecurityContext_0( ref SECURITY_HANDLE phCredential, IntPtr phContext, ref SecBufferDesc pInput, ContextFlags fContextReq, uint TargetDataRep, out SECURITY_HANDLE phNewContext, out SecBufferDesc pOutput, out ContextFlags pfContextAttr, //managed ulong == 64 bits!!! out SECURITY_INTEGER ptsTimeStamp );
internal static extern SecStatus AcquireCredentialsHandle( string pszPrincipal, string pszPackage, int fCredentialUse, IntPtr PAuthenticationID, void *pAuthData, IntPtr pGetKeyFn, IntPtr pvGetKeyArgument, ref SECURITY_HANDLE phCredential, IntPtr ptsExpiry );
internal static extern int AcquireCredentialsHandle_1( string pszPrincipal, //SEC_CHAR* string pszPackage, //SEC_CHAR* //"Kerberos","NTLM","Negotiative" int fCredentialUse, IntPtr PAuthenticationID, //_LUID AuthenticationID,//pvLogonID, //PLUID ref SEC_WINNT_AUTH_IDENTITY pAuthData, IntPtr pGetKeyFn, //SEC_GET_KEY_FN IntPtr pvGetKeyArgument, //PVOID ref SECURITY_HANDLE phCredential, //SecHandle //PCtxtHandle ref IntPtr ptsExpiry //PTimeStamp //TimeStamp ref );
public static extern int InitializeSecurityContext(ref SECURITY_HANDLE phCredential, //PCredHandle ref SECURITY_HANDLE phContext, //PCtxtHandle string pszTargetName, int fContextReq, int Reserved1, int TargetDataRep, ref SecBufferDesc SecBufferDesc, //PSecBufferDesc SecBufferDesc int Reserved2, out SECURITY_HANDLE phNewContext, //PCtxtHandle out SecBufferDesc pOutput, //PSecBufferDesc SecBufferDesc out uint pfContextAttr, //managed ulong == 64 bits!!! out SECURITY_INTEGER ptsExpiry); //PTimeStamp
internal static extern uint InitializeSecurityContext( ref SECURITY_HANDLE phCredential, ref SECURITY_HANDLE phContext, IntPtr pszTargetName, int fContextReq, int Reserved1, int TargetDataRep, ref SecBufferDesc pInput, int Reserved2, out SECURITY_HANDLE phNewContext, out SecBufferDesc pOutput, out uint pfContextAttr, out SecurityPackages.SECURITY_INTEGER ptsExpiry);
public static uint AcquireCredentialsHandle( string pszPrincipal, //SEC_CHAR* string pszPackage, //SEC_CHAR* //"Kerberos","NTLM","Negotiative" int fCredentialUse, IntPtr PAuthenticationID, //_LUID AuthenticationID,//pvLogonID, //PLUID IntPtr pAuthData, //PVOID int pGetKeyFn, //SEC_GET_KEY_FN IntPtr pvGetKeyArgument, //PVOID ref SECURITY_HANDLE phCredential, //SecHandle //PCtxtHandle ref ref SECURITY_INTEGER ptsExpiry) //PTimeStamp //TimeStamp ref { NotImplemented(MethodBase.GetCurrentMethod()); return(0); }
internal static extern int InitializeSecurityContext_1( ref SECURITY_HANDLE phCredential, //PCredHandle SECURITY_HANDLE phContext, //PCtxtHandle string pszTargetName, int fContextReq, int Reserved1, int TargetDataRep, SecBufferDesc pInput, //PSecBufferDesc SecBufferDesc int Reserved2, ref SECURITY_HANDLE phNewContext, //PCtxtHandle ref SecBufferDesc pOutput, //PSecBufferDesc SecBufferDesc out ContextFlags pfContextAttr, //managed ulong == 64 bits!!! IntPtr ptsExpiry //PTimeStamp );
internal static extern SecStatus InitializeSecurityContext_1( ref SECURITY_HANDLE phCredential, ref SECURITY_HANDLE phContext, string pszTargetName, ContextFlag fContextReq, int Reserved1, int TargetDataRep, ref SecBufferDesc pInput, int Reserved2, ref SECURITY_HANDLE phNewContext, ref SecBufferDesc pOutput, out ContextFlag pfContextAttr, ref IntPtr ptsExpiry );
public NTLMExecutor() { client_buffer = new SecBuffer(); client_desc = new SecBufferDesc(); server_buffer = new SecBuffer(); server_desc = new SecBufferDesc(); cred_handle = new SECURITY_HANDLE(0); ctxt_handle = new SECURITY_HANDLE(0); p_cred_handle = Marshal.AllocHGlobal(Marshal.SizeOf(cred_handle)); Marshal.StructureToPtr(cred_handle, p_cred_handle, false); p_ctxt_handle = Marshal.AllocHGlobal(Marshal.SizeOf(ctxt_handle)); Marshal.StructureToPtr(ctxt_handle, p_ctxt_handle, false); p_elevated_handle = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr))); }
protected override SECURITY_HANDLE AcquireCredential() { if (Settings.AcquisitionCredentials == null || string.IsNullOrWhiteSpace(Settings.AcquisitionCredentials.UserName) || string.IsNullOrWhiteSpace(Settings.AcquisitionCredentials.Password)) { return(base.AcquireCredential()); } SEC_WINNT_AUTH_IDENTITY pAuthData = new SEC_WINNT_AUTH_IDENTITY( Settings.AcquisitionCredentials.Domain, Settings.AcquisitionCredentials.UserName, Settings.AcquisitionCredentials.Password, SEC_WINNT_AUTH_IDENTITY_FLAGS.Unicode ); SECURITY_HANDLE phCredential = default(SECURITY_HANDLE); var result = AcquireCredentialsHandle_1( null, Mechanism, SECPKG_CRED_INBOUND, IntPtr.Zero, ref pAuthData, IntPtr.Zero, IntPtr.Zero, ref phCredential, IntPtr.Zero ); if (result < 0) { throw new Win32Exception(result); } return(phCredential); }
public static extern int DecryptMessage(ref SECURITY_HANDLE phContext, ref SecBufferDesc pMessage, uint MessageSeqNo, out uint pfQOP);
static extern int FreeCredentialsHandle(ref SECURITY_HANDLE phCredential); //PCredHandle
internal static extern uint FreeCredentialsHandle(ref SECURITY_HANDLE phCredential);
internal static extern uint DeleteSecurityContext(ref SECURITY_HANDLE phCredential);
static extern int DeleteSecurityContext(ref SECURITY_HANDLE phContext); //PCtxtHandle
public static extern int AcquireCredentialsHandle( System.IntPtr pszPrincipal, //SEC_CHAR* string pszPackage, //SEC_CHAR* //"Kerberos","NTLM","Negotiative" int fCredentialUse, IntPtr PAuthenticationID,//_LUID AuthenticationID,//pvLogonID, //PLUID System.IntPtr pAuthData,//PVOID int pGetKeyFn, //SEC_GET_KEY_FN IntPtr pvGetKeyArgument, //PVOID ref SECURITY_HANDLE phCredential, //SecHandle //PCtxtHandle ref ref SECURITY_INTEGER ptsExpiry);
public static extern int ImpersonateSecurityContext(ref SECURITY_HANDLE phContext);
public static extern int DeleteSecurityContext(SECURITY_HANDLE phContext);
public static extern int InitializeSecurityContext(ref SECURITY_HANDLE phCredential,//PCredHandle ref SECURITY_HANDLE phContext, //PCtxtHandle string pszTargetName, int fContextReq, int Reserved1, int TargetDataRep, ref SecBufferDesc SecBufferDesc, //PSecBufferDesc SecBufferDesc int Reserved2, out SECURITY_HANDLE phNewContext, //PCtxtHandle out SecBufferDesc pOutput, //PSecBufferDesc SecBufferDesc out uint pfContextAttr, //managed ulong == 64 bits!!! out SECURITY_INTEGER ptsExpiry);
public static extern int MakeSignature(ref SECURITY_HANDLE phContext, // Context to use uint fQOP, // Quality of Protection ref SecBufferDesc pMessage, // Message to sign uint MessageSeqNo);
public static extern int AcceptSecurityContext(ref SECURITY_HANDLE phCredential, IntPtr phContext, ref SecBufferDesc pInput, uint fContextReq, uint TargetDataRep, out SECURITY_HANDLE phNewContext, out SecBufferDesc pOutput, out uint pfContextAttr, //managed ulong == 64 bits!!! out SECURITY_INTEGER ptsTimeStamp);
public static extern int VerifySignature(ref SECURITY_HANDLE phContext, // Context to use ref SecBufferDesc pMessage, // Message to sign uint MessageSeqNo, // Message Sequence Num. out uint pfQOP);
public static extern int QueryContextAttributes(ref SECURITY_HANDLE phContext, uint ulAttribute, out SecPkgContext_Sizes pContextAttributes);
internal static extern SecStatus QueryContextAttributesString( ref SECURITY_HANDLE phContext, SecurityContextAttribute ulAttribute, ref SecPkgContext_SecString pBuffer );
public static extern int EncryptMessage(ref SECURITY_HANDLE phContext, uint fQOP, //managed ulong == 64 bits!!! ref SecBufferDesc pMessage, uint MessageSeqNo);