Ejemplo n.º 1
0
        private static DATA_BLOB PrepareDataBlob(byte[] buf)
        {
            if (buf == null)
            {
                buf = new byte[0];
            }
            DATA_BLOB db = new DATA_BLOB();

            db.cbData = buf.Length;
            db.pbData = Marshal.AllocHGlobal(db.cbData);
            Marshal.Copy(buf, 0, db.pbData, db.cbData);
            return(db);
        }
        private static DATA_BLOB PrepareDataBlob(byte[] buf)
        {
            DATA_BLOB data_blob;

            if (buf == null)
            {
                buf = new byte[0];
            }
            data_blob = new DATA_BLOB {
                cbData = buf.Length,
                pbData = Marshal.AllocHGlobal(data_blob.cbData)
            };
            Marshal.Copy(buf, 0, data_blob.pbData, data_blob.cbData);
            return(data_blob);
        }
 private static DATA_BLOB PrepareDataBlob(byte[] buf)
 {
     if (buf == null)
         buf = new byte[0];
     DATA_BLOB db = new DATA_BLOB();
     db.cbData = buf.Length;
     db.pbData = Marshal.AllocHGlobal(db.cbData);
     Marshal.Copy(buf, 0, db.pbData, db.cbData);
     return db;
 }
 internal static extern bool CryptUnprotectData(ref DATA_BLOB inputData, IntPtr description, ref DATA_BLOB entropy, IntPtr pReserved, ref CRYPTPROTECT_PROMPTSTRUCT promptStruct, uint flags, ref DATA_BLOB outputData);
 private static DATA_BLOB PrepareDataBlob(byte[] buf)
 {
     DATA_BLOB data_blob;
     if (buf == null)
     {
         buf = new byte[0];
     }
     data_blob = new DATA_BLOB {
         cbData = buf.Length,
         pbData = Marshal.AllocHGlobal(data_blob.cbData)
     };
     Marshal.Copy(buf, 0, data_blob.pbData, data_blob.cbData);
     return data_blob;
 }
 internal extern static bool CryptProtectData(ref DATA_BLOB inputData, string description, ref DATA_BLOB entropy, IntPtr pReserved, ref CRYPTPROTECT_PROMPTSTRUCT promptStruct, UInt32 flags, ref DATA_BLOB outputData);