/// <summary>
 /// Asynchronously encrypts the specified plain text using the default credential.
 /// </summary>
 /// <param name="crypto">An <see cref="IAsyncCrypto"/>.</param>
 /// <param name="plainText">The plain text.</param>
 /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
 /// <returns>The encrypted value as a string.</returns>
 public static Task <string> EncryptAsync(this IAsyncCrypto crypto, string plainText, CancellationToken cancellationToken = default) =>
 crypto.EncryptAsync(plainText, null, cancellationToken);
Exemplo n.º 2
0
 /// <summary>
 /// Asynchronously encrypts the specified plain text using the default credential.
 /// </summary>
 /// <param name="crypto">An <see cref="IAsyncCrypto"/>.</param>
 /// <param name="plainText">The plain text.</param>
 /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
 /// <returns>The encrypted value as a byte array.</returns>
 public static Task <byte[]> EncryptAsync(this IAsyncCrypto crypto, byte[] plainText, CancellationToken cancellationToken = default(CancellationToken)) =>
 crypto.EncryptAsync(plainText, null, cancellationToken);
 /// <summary>
 /// Asynchronously encrypts the specified plain text.
 /// </summary>
 /// <param name="crypto">An <see cref="IAsyncCrypto"/>.</param>
 /// <param name="plainText">The plain text.</param>
 /// <param name="credentialName">
 /// The name of the credential to use for this encryption operation,
 /// or null to use the default credential.
 /// </param>
 /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
 /// <returns>The encrypted value as a byte array.</returns>
 public static Task <byte[]> EncryptAsync(this IAsyncCrypto crypto, byte[] plainText, string credentialName = null, CancellationToken cancellationToken = default(CancellationToken)) =>
 crypto.EncryptAsync(plainText, credentialName, cancellationToken);