从s3获取签名的url以使用SSE-C解密上传的对象 [英] Getting signed url from s3 to decrypt uploaded object using SSE-C
本文介绍了从s3获取签名的url以使用SSE-C解密上传的对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以使用以下代码段成功加密和上传图像文件:
I was successfully able to encrypt and upload an image file using following snippet:
var ssecKey = '12345678901234567890123456789012'
var data = {
Key: 'testfolder/abc.png',
Body: buffer,
ContentEncoding: 'base64',
ContentType: 'image/png',
SSECustomerAlgorithm: 'AES256',
SSECustomerKey: ssecKey
};
s3.putObject(data, (err) => {
if (err) return console.error(err.stack)
s3.getSignedUrl('getObject', {
Key: 'testfolder/abc.png',
Expires: 160,
SSECustomerAlgorithm: 'AES256',
SSECustomerKey: ssecKey
}, (err, data) => {
if (err) return console.error(err.stack)
console.log(data);
});
});
为了找回解密的对象,我使用了getsignedurl方法,控制台输出了一个签名的url,但未解密图像,因此在浏览器上显示以下错误:
In order to get the decrypted object back, I used the getsignedurl method, the console outputs a signed url but is not decrypting the image, hence showing following error on browser:
我在这里可能做错了什么.
What could I probably be doing wrong here.
推荐答案
查看全文