简体   繁体   English

从启用 S3 服务器端加密的存储桶下载数据

[英]Download data from S3 Server-side encryption enabled bucket

I created an S3 Bucket with server-side encryption enabled using S3-managed keys.我使用 S3 托管密钥创建了一个启用了服务器端加密的 S3 存储桶。 Now I need to download the data using python script, but also need to decrypt as it gets downloaded.现在我需要使用 python 脚本下载数据,但还需要在下载时解密。

Following is my code:以下是我的代码:

#Creating Session With Boto3.
session = boto3.Session(
    aws_access_key_id='ID',
    aws_secret_access_key='KEY'
)

#Creating S3 Resource From the Session.
s3 = session.resource('s3')
my_bucket = s3.Bucket(BUCKET_NAME)

for my_bucket_object in my_bucket.objects.filter(Prefix='DIRECTORY_NAME/'):
...

But it is downloading encrypted data.但它正在下载加密数据。

It is not downloading encrypted data.它没有下载加密数据。 The encryption and decryption process for Server-Side Encryption with S3-managed keys is totally transparent to users.使用 S3 托管密钥的服务器端加密的加密和解密过程对用户是完全透明的。 It is only encrypted at rest .它仅在 rest 加密 You will never see the encrypted version of the object.永远不会看到 object 的加密版本。

If you are seeing encrypted data, then that is what the object contained when it was uploaded to S3.如果您看到的是加密数据,那么这就是 object 在上传到 S3 时包含的内容。

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

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