CryptographyEncryptAsync(String, String, SymmetricAlgorithm, CancellationToken) Method
Encrypts a string using a specified symmetrical encryption algorithm.
Namespace: InnerDrive.CoreAssembly: InnerDrive.Core (in InnerDrive.Core.dll) Version: 5.2.9417.0
public static Task<string> EncryptAsync(
string plainText,
string key,
SymmetricAlgorithm provider,
CancellationToken cancellationToken = default
)
- plainText String
- The string to encrypt.
- key String
- The key to encrypt the plaintext.
- provider SymmetricAlgorithm
- Any symmetric cryptography provider derived from
SymmetricAlgorithm to perform the encryption.
- cancellationToken CancellationToken (Optional)
- A CancellationToken
controlling the request lifetime
TaskStringA Base64-encoded
String containing the ciphertext.
The default encryption 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.