CryptographyDecryptAsync(String, String, SymmetricAlgorithm) Method

Decrypts a ciphertext using a specific symmetric algorithm.

Definition

Namespace: InnerDrive.Core
Assembly: InnerDrive.Core (in InnerDrive.Core.dll) Version: 5.2.9017.0
C#
public static Task<string> DecryptAsync(
	string cipherText,
	string key,
	SymmetricAlgorithm provider
)

Parameters

cipherText  String
The encrypted text to decrypt.
key  String
The key to decrypt the ciphertext.
provider  SymmetricAlgorithm
Any symmetric cryptography provider derived from SymmetricAlgorithm that will perform the decryption.

Return Value

TaskString
A String containing the decrypted plaintext.

Remarks

The default decryption algorithm is DES. Any other class derived from SymmetricAlgorithm can be used instead.

Adapted from work by Frank Fong and William Rawls of the Code Project.

The cipher text can be any length other than 0; the key length must be at least MinKeyLength and no more than MaxKeyLength.

Exceptions

ArgumentExceptioncipherText is null or Empty
ArgumentNullExceptionprovider is null

See Also