Unprotect() public static method

public static Unprotect ( byte encryptedData, byte optionalEntropy, DataProtectionScope scope ) : byte[]
encryptedData byte
optionalEntropy byte
scope DataProtectionScope
return byte[]
Example #1
0
 /// <summary>
 ///     Unprotects the specified encrypted data by applying an decryption algorthim specified by the
 ///     <see cref="DataProtectionScope" />.
 /// </summary>
 /// <param name="encryptedData">The encrypted data.</param>
 /// <param name="optionalEntropy">The optional entropy.</param>
 /// <param name="scope">The scope.</param>
 /// <returns>
 ///     The unencrypted byte array, otherwise the original encrypted byte array.
 /// </returns>
 /// <exception cref="ArgumentNullException">The encryptedData parameter is null.</exception>
 /// <exception cref="CryptographicException">The cryptographic protection failed.</exception>
 /// <exception cref="PlatformNotSupportedException">The operating system does not support this method.</exception>
 /// <exception cref="OutOfMemoryException">Out of memory.</exception>
 public static byte[] Unprotect(byte[] encryptedData, string optionalEntropy, DataProtectionScope scope)
 {
     byte[] salt = (!string.IsNullOrEmpty(optionalEntropy)) ? Encoding.Unicode.GetBytes(optionalEntropy) : null;
     byte[] data = ProtectedData.Unprotect(encryptedData, salt, scope);
     return(data);
 }
Example #2
0
 protected override byte[] ProviderUnprotect(byte[] encryptedData)
 {
     // Delegate to ProtectedData
     return(ProtectedData.Unprotect(encryptedData, GetHashedPurpose(), Scope));
 }