Exemplo n.º 1
0
 // This method will demand CryptographicPermissionFlags.Encrypt = true
 private void ProtectMemory()
 {
     if (m_length == 0)
     {
         return;
     }
     ProtectedMemory.Protect(m_buffer, MemoryProtectionScope.SameProcess);
 }
Exemplo n.º 2
0
        private void UnProtectMemory()
        {
            if (m_length == 0)
            {
                return;
            }

            // This is an internal operation so stop the Decrypt Demand
            new CryptographicPermission(CryptographicPermissionFlags.Decrypt).Assert();

            ProtectedMemory.Unprotect(m_buffer, MemoryProtectionScope.SameProcess);
        }