Decrypts the data in a specified byte array and returns a byte array that contains the decrypted data.
- encryptedData
- A byte array containing data encrypted using the ProtectedData.Protect(Byte[], Byte[], DataProtectionScope) method.
- optionalEntropy
- An optional additional byte array that was used to encrypt the data, or null if the additional byte array was not used.
- scope
- One of the enumeration values that specifies the scope of data protection that was used to encrypt the data.
A byte array representing the decrypted data.
This method can be used to unprotect data that was encrypted using the ProtectedData.Protect(Byte[], Byte[], DataProtectionScope) method. If the optionalEntropy parameter was used during encryption, it must be supplied to unencrypt the data.
If you use this method during impersonation, you may receive the following error: "Key not valid for use in specified state." To prevent this error, load the profile of the user you want to impersonate before calling the method.