【发布时间】:2019-04-06 23:31:42
【问题描述】:
我每天都会将几个 PGP 加密文件导入我的 Blob 存储区。我需要能够将它们解密到同一个 blob 容器中的另一个位置。
我已经知道我必须创建一个自定义批处理活动才能在 ADF 中执行此操作,我只是无法弄清楚如何将 blob 获取到 OpenPgp
来自 bitscry.com 的示例代码建议使用流作为示例:
using (FileStream inputFileStream = new FileStream(@"C:\TEMP\keys\content__encrypted2.pgp", FileMode.Open))
using (Stream outputFileStream = File.Create(@"C:\TEMP\keys\content__decrypted2.txt"))
using (Stream privateKeyStream = new FileStream(@"C:\TEMP\keys\private.asc", FileMode.Open))
pgp.DecryptStream(inputFileStream, outputFileStream, privateKeyStream, "password");
我尝试将 blob 作为流打开,但它不起作用。
这是尝试将 blob 用作流的代码:
Stream sourceStream = keyBlockBlob.OpenRead();
Stream keyStream = sourceCloudBlockBlob.OpenRead();
Stream targetStream = targetCloudBlockBlob.OpenWrite();
pgp.DecryptStream(sourceStream, targetStream, keyStream, "password");
【问题讨论】:
标签: c# azure-storage openpgp