Пример #1
0
 // This method will demand CryptographicPermissionFlags.Encrypt = true
 private void ProtectMemory()
 {
     if (m_length == 0)
     {
         return;
     }
     ProtectedMemory.Protect(m_buffer, MemoryProtectionScope.SameProcess);
 }
Пример #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);
        }