ProtectedData.Unprotect Method
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Decrypts the data in a specified byte array and returns a byte array that contains the decrypted data.
Namespace: System.Security.Cryptography
Assembly: mscorlib.Extensions (in mscorlib.Extensions.dll)
Syntax
'Declaration
<SecuritySafeCriticalAttribute> _
Public Shared Function Unprotect ( _
encryptedData As Byte(), _
optionalEntropy As Byte() _
) As Byte()
[SecuritySafeCriticalAttribute]
public static byte[] Unprotect(
byte[] encryptedData,
byte[] optionalEntropy
)
Parameters
- encryptedData
Type: array<System.Byte[]
A byte array containing data encrypted using the Protect method.
- optionalEntropy
Type: array<System.Byte[]
An optional additional byte array that was used to encrypt the data, or nulla null reference (Nothing in Visual Basic) if the additional byte array was not used.
Return Value
Type: array<System.Byte[]
A byte array representing the decrypted data.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | The encryptedData parameter is nulla null reference (Nothing in Visual Basic). |
CryptographicException | The decryption failed. |
NotSupportedException | The operating system does not support this method. |
OutOfMemoryException | Out of memory. |
Remarks
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. |
Version Information
Silverlight for Windows Phone
Supported in: Windows Phone OS 7.1
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
See Also