Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge PR #45 "Add ServiceURL option for KMS client" and PR#46 "Version Bump & .NET 6" #47

Merged
merged 2 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Amazon.Extensions.S3.Encryption.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFrameworks>net35;net45;netstandard2.0;netcoreapp3.1</TargetFrameworks>
<Version>2.0.5</Version>
<Version>2.1.0</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>Amazon.Extensions.S3.Encryption</PackageId>
<Title>Amazon S3 Encryption Client for .NET</Title>
Expand All @@ -15,8 +15,8 @@
<PackageIcon>icon.png</PackageIcon>
<RepositoryUrl>https://github.com/aws/amazon-s3-encryption-client-dotnet/</RepositoryUrl>
<Company>Amazon Web Services</Company>
<AssemblyVersion>2.0.5</AssemblyVersion>
<FileVersion>2.0.5</FileVersion>
<AssemblyVersion>2.1.0</AssemblyVersion>
<FileVersion>2.1.0</FileVersion>

<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\public.snk</AssemblyOriginatorKeyFile>
Expand Down
9 changes: 9 additions & 0 deletions src/AmazonS3CryptoConfigurationBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Amazon.KeyManagementService;
using Amazon.S3;

namespace Amazon.Extensions.S3.Encryption
Expand All @@ -41,5 +42,13 @@ public AmazonS3CryptoConfigurationBase()
// By default, store encryption info in metadata
StorageMode = CryptoStorageMode.ObjectMetadata;
}
/// <summary>
/// Configuration for the AWS Key Management Service client that will be used internally when encrypting S3 objects with KMS keys.
/// </summary>
/// <remarks>
/// If not specified here, the internal KMS client will inherit the region, timeout, and proxy configuration from the S3 configuration
/// </remarks>
public AmazonKeyManagementServiceConfig KmsConfig { get; set; }

}
}
28 changes: 18 additions & 10 deletions src/AmazonS3EncryptionClientBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,27 @@ internal IAmazonKeyManagementService KMSClient
{
if (kmsClient == null)
{
var kmsConfig = new AmazonKeyManagementServiceConfig
if (this.S3CryptoConfig.KmsConfig != null)
{
RegionEndpoint = this.Config.RegionEndpoint,
Timeout = this.Config.Timeout
};

var proxySettings = this.Config.GetWebProxy();
if(proxySettings != null)
kmsClient = new AmazonKeyManagementServiceClient(Credentials,
this.S3CryptoConfig.KmsConfig);
}
else
{
kmsConfig.SetWebProxy(proxySettings);
var kmsConfig = new AmazonKeyManagementServiceConfig
{
RegionEndpoint = this.Config.RegionEndpoint,
Timeout = this.Config.Timeout
};

var proxySettings = this.Config.GetWebProxy();
if(proxySettings != null)
{
kmsConfig.SetWebProxy(proxySettings);
}

kmsClient = new AmazonKeyManagementServiceClient(Credentials, kmsConfig);
}

kmsClient = new AmazonKeyManagementServiceClient(Credentials, kmsConfig);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>net6</TargetFrameworks>
<IsPackable>false</IsPackable>

<!-- workaround per https://github.com/Microsoft/msbuild/issues/1333 -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net35;net45;netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>net35;net45;net6</TargetFrameworks>
<DefineConstants Condition="'$(TargetFramework)' == 'net35'">$(DefineConstants);DEBUG;TRACE;BCL;BCL35;AWS_APM_API</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net45'">$(DefineConstants);DEBUG;TRACE;BCL;BCL45;ASYNC_AWAIT;</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'netcoreapp2.1'">$(DefineConstants);NETSTANDARD;AWS_ASYNC_API</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net6'">$(DefineConstants);NETSTANDARD;AWS_ASYNC_API</DefineConstants>
<IsPackable>false</IsPackable>

<!-- workaround per https://github.com/Microsoft/msbuild/issues/1333 -->
Expand All @@ -21,10 +21,10 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Condition="'$(TargetFramework)' == 'netcoreapp2.1'" Include="Moq" Version="4.18.4" />
<PackageReference Condition="'$(TargetFramework)' == 'net6'" Include="Moq" Version="4.18.4" />
<PackageReference Condition="'$(TargetFramework)' == 'net35' Or '$(TargetFramework)' == 'net45'" Include="Moq" Version="4.0.10827" />
<PackageReference Condition="'$(TargetFramework)' == 'net35' Or '$(TargetFramework)' == 'net45'" Include="xunit.extensions" Version="1.9.2" />
<PackageReference Condition="'$(TargetFramework)' == 'netcoreapp2.1'" Include="xunit" Version="2.4.1" />
<PackageReference Condition="'$(TargetFramework)' == 'net6'" Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
</ItemGroup>

Expand Down