예제 #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);
        }
예제 #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);
        }
예제 #3
0
        public void Dispose()
        {
            if (pBuffers != IntPtr.Zero)
            {
                Debug.Assert(cBuffers == 1);
#if NET452 || DNX452 || NETSTANDARD1_6
                SecBuffer ThisSecBuffer =
                    (SecBuffer)Marshal.PtrToStructure <SecBuffer>(pBuffers);
#else
                SecBuffer ThisSecBuffer = (SecBuffer)Marshal.PtrToStructure(pBuffers, typeof(SecBuffer));
#endif
                ThisSecBuffer.Dispose();
                Marshal.FreeHGlobal(pBuffers);
                pBuffers = IntPtr.Zero;
            }
        }
예제 #4
0
        public byte[] GetSecBufferByteArray()
        {
            byte[] Buffer = null;

            if (pBuffers == IntPtr.Zero)
            {
                throw new InvalidOperationException("Object has already been disposed!!!");
            }
            Debug.Assert(cBuffers == 1);
#if NET452 || DNX452 || NETSTANDARD1_6
            SecBuffer secBuffer = (SecBuffer)Marshal.PtrToStructure <SecBuffer>(pBuffers);
#else
            SecBuffer secBuffer = (SecBuffer)Marshal.PtrToStructure(pBuffers, typeof(SecBuffer));
#endif
            if (secBuffer.cbBuffer > 0)
            {
                Buffer = new byte[secBuffer.cbBuffer];
                Marshal.Copy(secBuffer.pvBuffer, Buffer, 0, secBuffer.cbBuffer);
            }
            return(Buffer);
        }
 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);
 }
        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);
        }