In
EncryptFile
, you use a
FileStream
to read the data to encrypt. With some modifications, you can use a
Stream
that comes from a web response instead.
c# - Convert to Stream from a Url - Stack Overflow[
^]:
private static Stream GetStreamFromUrl(string url)
{
byte[] imageData = null;
using (var wc = new System.Net.WebClient())
imageData = wc.DownloadData(url);
return new MemoryStream(imageData);
}
You can use that method to get a Stream from an URL and then use that instead of the FileStream you used before.