public int HandleType2(byte[] ntlmBytes) { SecBuffer secBuffer = secServerBufferDesc.GetSecBuffer(); byte[] newNtlmBytes = secBuffer.GetBytes(); if (ntlmBytes.Length >= newNtlmBytes.Length) { for (int idx = 0; idx < ntlmBytes.Length; ++idx) { if (idx < newNtlmBytes.Length) { ntlmBytes[idx] = newNtlmBytes[idx]; } else { ntlmBytes[idx] = 0; } } } else { Console.WriteLine("NTLM Type2 cannot be replaced. New buffer too big"); } return(0); }
public byte[] GetSecBufferBytes() { if (pBuffers == IntPtr.Zero) { throw new ObjectDisposedException(nameof(SecBufferDesc)); } SecBuffer secBuffer = Marshal2.PtrToStructure <SecBuffer>(pBuffers); return(secBuffer.GetBytes()); }
public byte[] GetSecBufferBytes() { if (pBuffers == IntPtr.Zero) { throw new ObjectDisposedException("SecBufferDesc"); } SecBuffer secBuffer = (SecBuffer)Marshal.PtrToStructure(pBuffers, typeof(SecBuffer)); return(secBuffer.GetBytes()); }