【发布时间】:2019-01-27 10:36:27
【问题描述】:
我将文件上传到 Google 存储桶。现在,我生成了它的签名网址(基于此solution)
private static Uri SignUrl(Stream jsonCertificateStream, string bucketName, string objectName, TimeSpan expireAfter, string[] scopes, HttpMethod verb)
{
string url;
var urlSigner = UrlSigner.FromServiceAccountData(jsonCertificateStream);
url = urlSigner.Sign(
bucketName,
objectName,
expireAfter,
verb);
return new Uri(url);
}
我得到了一个在我的浏览器上运行良好的 URI。到这里——一切都很好。
现在,我正在使用客户加密密钥来加密我上传的文件。所以,我删除了文件并再次上传 - 现在它已加密。
问题是现在SignUrl() 方法不再起作用了。
使用浏览器测试SignUrl() 方法的结果时 - 我得到:
<Error>
<Code>ResourceIsEncryptedWithCustomerEncryptionKey</Code>
<Message>
The resource is encrypted with a customer encryption key.
</Message>
<Details>
The requested object is encrypted by a customer-supplied encryption key.
</Details>
</Error>
我猜是因为我的文件是用其他密钥加密的。
怎么做才对?
【问题讨论】: