System.Security.Cryptography.ProtectedMemory.Protect Method

Protects the specified data.

Syntax

public static void Protect (byte[] userData, MemoryProtectionScope scope)

Parameters

userData
The byte array containing data in memory to protect. The array must be a multiple of 16 bytes.
scope
One of the enumeration values that specifies the scope of memory protection.

Remarks

This method can be used to protect data in memory. Note that the method does not make a copy of the data, but encrypts the byte array in place. The userData parameter must be 16 bytes in length or a multiple of 16 bytes.

Support for this method is available in the Windows XP and later operating systems.

Requirements

Namespace: System.Security.Cryptography
Assembly: System.Security (in System.Security.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0