Example #1
0
        public SecBufferDesc(byte[] secBufferBytes)
        {
            ulVersion = (int)SecBufferType.SECBUFFER_VERSION;
            cBuffers  = 1;
            SecBuffer ThisSecBuffer = new SecBuffer(secBufferBytes);

            pBuffers = Marshal.AllocHGlobal(Marshal.SizeOf(ThisSecBuffer));
            Marshal.StructureToPtr(ThisSecBuffer, pBuffers, false);
        }
Example #2
0
        public IntPtr pBuffers; //Point to SecBuffer

        public SecBufferDesc(int bufferSize)
        {
            ulVersion = (int)SecBufferType.SECBUFFER_VERSION;
            cBuffers  = 1;
            SecBuffer secBuffer = new SecBuffer(bufferSize);

            pBuffers = Marshal.AllocHGlobal(Marshal.SizeOf(secBuffer));
            Marshal.StructureToPtr(secBuffer, pBuffers, false);
        }
Example #3
0
 public void Dispose()
 {
     if (pBuffers != IntPtr.Zero)
     {
         Debug.Assert(cBuffers == 1);
         SecBuffer ThisSecBuffer =
             (SecBuffer)Marshal.PtrToStructure(pBuffers, typeof(SecBuffer));
         ThisSecBuffer.Dispose();
         Marshal.FreeHGlobal(pBuffers);
         pBuffers = IntPtr.Zero;
     }
 }
Example #4
0
        public byte[] GetSecBufferByteArray()
        {
            byte[] Buffer = null;

            if (pBuffers == IntPtr.Zero)
            {
                throw new InvalidOperationException("Object has already been disposed!!!");
            }
            Debug.Assert(cBuffers == 1);
            SecBuffer secBuffer = (SecBuffer)Marshal.PtrToStructure(pBuffers,
                                                                    typeof(SecBuffer));

            if (secBuffer.cbBuffer > 0)
            {
                Buffer = new byte[secBuffer.cbBuffer];
                Marshal.Copy(secBuffer.pvBuffer, Buffer, 0, secBuffer.cbBuffer);
            }
            return(Buffer);
        }
Example #5
0
 public SecBufferDesc(byte[] secBufferBytes)
 {
     ulVersion = (int)SecBufferType.SECBUFFER_VERSION;
     cBuffers = 1;
     SecBuffer ThisSecBuffer = new SecBuffer(secBufferBytes);
     pBuffers = Marshal.AllocHGlobal(Marshal.SizeOf(ThisSecBuffer));
     Marshal.StructureToPtr(ThisSecBuffer, pBuffers, false);
 }
Example #6
0
        public IntPtr pBuffers; //Point to SecBuffer

        #region Constructors

        public SecBufferDesc(int bufferSize)
        {
            ulVersion = (int)SecBufferType.SECBUFFER_VERSION;
            cBuffers = 1;
            SecBuffer secBuffer = new SecBuffer(bufferSize);
            pBuffers = Marshal.AllocHGlobal(Marshal.SizeOf(secBuffer));
            Marshal.StructureToPtr(secBuffer, pBuffers, false);
        }