0
我有以下代码将图像上传到Azure blob存储。我想在上传到blob之前加密图像数据。我已经有一个帮助类加密和解密,我可以通过调用AESEncryption.Encrypt(“plainText”,“key”,salt“);在上传到azure blob存储之前加密图像数据
我只是想弄清楚tom如何整合我的加密方法到代码中。另外,我猜测,一旦它的加密,而不是调用blob.UploadFromFile()我会打电话blob.UploadFromByteArray()。
public override Task ExecutePostProcessingAsync()
{
try
{
// Upload the files to azure blob storage and remove them from local disk
foreach (var fileData in this.FileData)
{
var filename = BuildFilename(Path.GetExtension(fileData.Headers.ContentDisposition.FileName.Trim('"')));
// Retrieve reference to a blob
var blob = _container.GetBlockBlobReference(filename);
blob.Properties.ContentType = fileData.Headers.ContentType.MediaType;
blob.UploadFromFile(fileData.LocalFileName, FileMode.Open);
File.Delete(fileData.LocalFileName);
Files.Add(new FileDetails
{
ContentType = blob.Properties.ContentType,
Name = blob.Name,
Size = blob.Properties.Length,
Location = blob.Uri.AbsoluteUri
});
}
}
catch (Exception ex)
{
throw ex;
}
return base.ExecutePostProcessingAsync();
}
谢谢我想出了如何使用方法2.我将很快用我的解决方案编辑我的文章。 – PercivalMcGullicuddy
您好@Ghandicap,请您提供您的建议,从blob存储下载加密文件。 –