Skip to content

Commit

Permalink
TransferUtilityDownloadDirectoryRequest is missing SSE-C properties
Browse files Browse the repository at this point in the history
fixes #3147
  • Loading branch information
CGDM-LRocher authored and dscpinheiro committed Jan 23, 2024
1 parent 4650fa5 commit 0661fa9
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ private TransferUtilityDownloadRequest ConstructTransferUtilityDownloadRequest(S
downloadRequest.Key = s3Object.Key;
var file = s3Object.Key.Substring(prefixLength).Replace('/', Path.DirectorySeparatorChar);
downloadRequest.FilePath = Path.Combine(this._request.LocalDirectory, file);

downloadRequest.ServerSideEncryptionCustomerMethod = this._request.ServerSideEncryptionCustomerMethod;
downloadRequest.ServerSideEncryptionCustomerProvidedKey = this._request.ServerSideEncryptionCustomerProvidedKey;
downloadRequest.ServerSideEncryptionCustomerProvidedKeyMD5 = this._request.ServerSideEncryptionCustomerProvidedKeyMD5;

//Ensure the target file is a rooted within LocalDirectory. Otherwise error.
if(!InternalSDKUtils.IsFilePathRootedWithDirectoryPath(downloadRequest.FilePath, _request.LocalDirectory))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
using System.Linq;
using Amazon.S3.Model;
using Amazon.Util;
using Amazon.Runtime.Internal;
using System.Globalization;


Expand All @@ -47,6 +48,10 @@ public class TransferUtilityDownloadDirectoryRequest
private DateTime? unmodifiedSinceDateUtc;
private bool disableSlashCorrection = false;

private ServerSideEncryptionCustomerMethod serverSideCustomerEncryption;
private string serverSideEncryptionCustomerProvidedKey;
private string serverSideEncryptionCustomerProvidedKeyMD5;

/// <summary>
/// Gets or sets the name of the bucket.
/// </summary>
Expand Down Expand Up @@ -255,6 +260,47 @@ public bool DisableSlashCorrection
set { this.disableSlashCorrection = value; }
}

/// <summary>
/// The Server-side encryption algorithm to be used with the customer provided key.
/// </summary>
public ServerSideEncryptionCustomerMethod ServerSideEncryptionCustomerMethod
{
get { return this.serverSideCustomerEncryption; }
set { this.serverSideCustomerEncryption = value; }
}

/// <summary>
/// The base64-encoded encryption key for Amazon S3 to use to decrypt the object
/// <para>
/// Using the encryption key you provide as part of your request Amazon S3 manages both the encryption, as it writes
/// to disks, and decryption, when you access your objects. Therefore, you don't need to maintain any data encryption code. The only
/// thing you do is manage the encryption keys you provide.
/// </para>
/// <para>
/// When you retrieve an object, you must provide the same encryption key as part of your request. Amazon S3 first verifies
/// the encryption key you provided matches, and then decrypts the object before returning the object data to you.
/// </para>
/// <para>
/// Important: Amazon S3 does not store the encryption key you provide.
/// </para>
/// </summary>
[AWSProperty(Sensitive = true)]
public string ServerSideEncryptionCustomerProvidedKey
{
get { return this.serverSideEncryptionCustomerProvidedKey; }
set { this.serverSideEncryptionCustomerProvidedKey = value; }
}

/// <summary>
/// The MD5 of the customer encryption key specified in the ServerSideEncryptionCustomerProvidedKey property. The MD5 is
/// base 64 encoded. This field is optional, the SDK will calculate the MD5 if this is not set.
/// </summary>
public string ServerSideEncryptionCustomerProvidedKeyMD5
{
get { return this.serverSideEncryptionCustomerProvidedKeyMD5; }
set { this.serverSideEncryptionCustomerProvidedKeyMD5 = value; }
}

/// <summary>
/// The event for DownloadedDirectoryProgressEvent notifications. All
/// subscribers will be notified when a new progress
Expand Down

0 comments on commit 0661fa9

Please sign in to comment.