ProtectedData.Unprotect Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Decrypts the data in a specified byte array and returns a byte array that contains the decrypted data.
Assembly: mscorlib.Extensions (in mscorlib.Extensions.dll)
'Declaration Public Shared Function Unprotect ( _ encryptedData As Byte(), _ optionalEntropy As Byte() _ ) As Byte()
Parameters
- encryptedData
- Type:
System.Byte
()
A byte array containing data encrypted using the Protect method.
- optionalEntropy
- Type:
System.Byte
()
An optional additional byte array that was used to encrypt the data, or Nothing if the additional byte array was not used.
| Exception | Condition |
|---|---|
| ArgumentNullException | The encryptedData parameter is Nothing. |
| CryptographicException | The decryption failed. |
| NotSupportedException | The operating system does not support this method. |
| OutOfMemoryException | Out of memory. |
This method can be used to unprotect data that was encrypted using the Protect method. If the optionalEntropy parameter was used during encryption, it must be supplied to unencrypt the data.
Note: |
|---|
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. |
Note: