Bearbeiten

Freigeben über


MachineKey.Unprotect(Byte[], String[]) Method

Definition

Unprotects the specified data, which was protected by the Protect(Byte[], String[]) method.

public:
 static cli::array <System::Byte> ^ Unprotect(cli::array <System::Byte> ^ protectedData, ... cli::array <System::String ^> ^ purposes);
public static byte[] Unprotect (byte[] protectedData, params string[] purposes);
static member Unprotect : byte[] * string[] -> byte[]
Public Shared Function Unprotect (protectedData As Byte(), ParamArray purposes As String()) As Byte()

Parameters

protectedData
Byte[]

The ciphertext data to unprotect.

purposes
String[]

A list of purposes that describe what the data is meant for. This must be the same value that was passed to the Protect(Byte[], String[]) method when the data was protected.

Returns

Byte[]

The plaintext data.

Exceptions

The protectedData parameter is null.

The purposes array contains one or more white-space-only entries.

Possible causes include the following:

  • The protected data was tampered with.

  • The value of the purposes parameter is not the same as the value that was specified when the data was protected.

  • The application is deployed to more than one server and is using auto-generated encryption keys.

Remarks

For information about this method, see the Protect method.

Applies to