/// <summary> /// Encrypts a single block of data. The amount of data that may be encrypted is determined /// by the target key type and the encryption algorithm. /// </summary> /// <param name="keyBundle">The key bundle to use for encryption</param> /// <param name="algorithm">The encryption algorithm. For more information on possible algorithm types, see JsonWebKeyEncryptionAlgorithm.</param> /// <param name="plaintext">The plain text to encrypt</param> /// <returns></returns> public static async Task <KeyOperationResult> EncryptDataAsync(this KeyVaultClient client, KeyBundle keyBundle, string algorithm, byte[] plaintext) { if (keyBundle == null) { throw new ArgumentNullException("keyBundle"); } return(await client.EncryptDataAsync(keyBundle.Key, algorithm, plaintext).ConfigureAwait(false)); }