System.Security.Cryptography.ProtectedData.Unprotect C# (CSharp) Метод

Unprotect() публичный статический Метод

public static Unprotect ( byte encryptedData, byte optionalEntropy, DataProtectionScope scope ) : byte[]
encryptedData byte
optionalEntropy byte
scope DataProtectionScope
Результат byte[]
        public static byte[] Unprotect(byte[] encryptedData, byte[] optionalEntropy, DataProtectionScope scope)
        {
            if (encryptedData == null)
                throw new ArgumentNullException(nameof(encryptedData));

            return ProtectOrUnprotect(encryptedData, optionalEntropy, scope, protect: false);
        }

Same methods

ProtectedData::Unprotect ( byte encryptedData, byte optionalEntropy, System scope ) : byte[]

Usage 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);
 }
All Usage Examples Of System.Security.Cryptography.ProtectedData::Unprotect