简体   繁体   English

加密AWS S3存储桶中的对象

[英]encrypt object in aws s3 bucket

I am saving some images/objects in aws s3 bucket from my application. 我正在从应用程序将一些图像/对象保存在aws s3存储桶中。 First i am getting signed url from nodejs service api and uploading images or files to singed url using jquery ajax. 首先,我从nodejs服务api获取签名的url,并使用jquery ajax将图像或文件上传到单个url。 I can open image or object using the link provided in the properties ( https://s3.amazonaws.com/bucketname/objectname ). 我可以使用属性( https://s3.amazonaws.com/bucketname/objectname )中提供的链接打开图像或对象。

I want to provide security for each uploaded object. 我想为每个上传的对象提供安全性。 Even by chance if any anonymous user gets the link ( https://s3.amazonaws.com/bucketname/objectname ) somewhere he should not be able to open it. 即使偶然地有任何匿名用户在某处获得了链接( https://s3.amazonaws.com/bucketname/objectname ),他也无法打开它。 They (objects) should be accessed and open only cases like when request has some headers key values etc. I tried server side encryption by specifying header key values in request as shown below. 应该访问它们(对象),并且仅打开诸如请求具有某些标头密钥值等的情况。我尝试通过在请求中指定标头密钥值来尝试服务器端加密,如下所示。

        var file = document.getElementById('fileupload').files[0];
        $.ajax({
            url: signedurl,
            type: "PUT",
            data: file,
            header:{'x-amz-server-side-encryption':'AES256'},               
            contentType: file.type,
            processData: false,
            success: function (result) {
                var res = result;

            },
            error: function (error) {
                alert(error);
            }

Doesn't sever side encryption keep encrypted object on s3 bucket storage? 服务器端加密不会将加密对象保留在s3存储桶中吗? Does it only encrypts while transferring and decrypts before saving on s3 storage? 它是否仅在传输时加密并在保存到s3存储之前解密?

If it stores encrypted object on s3 storage then how can i open it using the link shown in properties. 如果将加密对象存储在s3存储上,那么如何使用属性中显示的链接将其打开。

Server-Side Encryption (SSE) in Amazon S3 encrypts objects at rest (stored on disk) but decrypts objects when they are retrieved. Amazon S3中的服务器端加密(SSE)静止的对象(存储在磁盘上)进行加密但是在检索到对象时对它们进行解密。 Therefore, it is a transparent form of encryption. 因此,它是一种透明的加密形式。

If you wish to keep objects in Amazon S3 private, but make them available to specific authorized users, I would recommend using Pre-Signed URLs . 如果您希望将对象保留在Amazon S3中私有,但让特定的授权用户可以使用,则建议使用Pre-Signed URL

This works by having your application generate a URL that provides time-limited access to a specific object in Amazon S3. 通过让您的应用程序生成URL来提供此时间,该URL提供了对Amazon S3中特定对象的限时访问的功能。 The objects are otherwise kept private so they are not accessible. 否则,这些对象将保持私有状态,因此无法访问它们。

See documentation: Share an Object with Others 请参阅文档: 与他人共享对象

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM