/// <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="key">The web key 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, JsonWebKey key, string algorithm, byte[] plaintext)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }

            if (string.IsNullOrEmpty(algorithm))
            {
                throw new ArgumentNullException("algorithm");
            }

            if (plaintext == null)
            {
                throw new ArgumentNullException("plaintext");
            }

            return(await client.EncryptAsync(key.Kid, algorithm, plaintext).ConfigureAwait(false));
        }