使用AWS SDK PHP放置对象时,在S3中选择服务器端加密非常容易:
$result = $client->putObject(array(
'Bucket' => $bucket,
'Key' => $key,
'SourceFile' => $source_file,
'ServerSideEncryption' => 'AES256'
));
使用AWS SDK C ++将对象置于S3中类似于:
Aws::S3::Model::PutObjectRequest object_request;
object_request.WithBucket(bucket_name).WithKey(key_name);
auto input_data = Aws::MakeShared<Aws::FStream>(key_name.c_str(), dir_name.c_str(), std::ios_base::in);
object_request.SetBody(input_data);
auto put_object_outcome = s3_client.PutObject(object_request);
但是,如何使用AWS SDK C ++选择服务器端加密?
答案 0 :(得分:1)
好的,我找到了解决方案:
object_request.WithServerSideEncryption(Aws::S3::Model::ServerSideEncryption::AES256);
答案 1 :(得分:0)
似乎您正在使用sdk的v1,因此您可以使用WithServerSideEncryptionMethod
object_request.WithServerSideEncryptionMethod(ServerSideEncryptionMethod.AES256);