Skip to content

Commit

Permalink
CSHARP-4912: Refactor CSFLE library to separate package (mongodb#1423)
Browse files Browse the repository at this point in the history
  • Loading branch information
adelinowona authored Oct 4, 2024
1 parent c2a64f4 commit 5e1f3fd
Show file tree
Hide file tree
Showing 140 changed files with 5,779 additions and 793 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,6 @@ packages
/tools
/evergreen/krb5.conf.empty
.config
**/*.so
**/*.dylib
**/*.dll
26 changes: 20 additions & 6 deletions CSharpDriver.sln
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FaasTests", "FaasTests", "{
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MongoDB.Driver.LambdaTest", "tests\FaasTests\LambdaTests\MongoDB.Driver.LambdaTest\MongoDB.Driver.LambdaTest.csproj", "{33B11279-DA4A-46EA-99BF-9DEDCAC50D95}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MongoDB.Driver.Authentication.AWS", "src\MongoDB.Driver.Authentication.AWS\MongoDB.Driver.Authentication.AWS.csproj", "{16FC2E26-8E6B-4D4A-8330-7639D4039E51}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MongoDB.Libmongocrypt", "src\MongoDB.Libmongocrypt\MongoDB.Libmongocrypt.csproj", "{642518BC-D28A-4ABC-851C-BC18CC34EEDA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MongoDB.Libmongocrypt.Tests", "tests\MongoDB.Libmongocrypt.Tests\MongoDB.Libmongocrypt.Tests.csproj", "{AB4AD0CB-756C-444F-9F37-26DA35148934}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MongoDB.Driver.Authentication.AWS", "src\MongoDB.Driver.Authentication.AWS\MongoDB.Driver.Authentication.AWS.csproj", "{A0CAC199-457E-4862-AF9E-971C7A77CBF9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -114,10 +118,18 @@ Global
{33B11279-DA4A-46EA-99BF-9DEDCAC50D95}.Debug|Any CPU.Build.0 = Debug|Any CPU
{33B11279-DA4A-46EA-99BF-9DEDCAC50D95}.Release|Any CPU.ActiveCfg = Release|Any CPU
{33B11279-DA4A-46EA-99BF-9DEDCAC50D95}.Release|Any CPU.Build.0 = Release|Any CPU
{16FC2E26-8E6B-4D4A-8330-7639D4039E51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{16FC2E26-8E6B-4D4A-8330-7639D4039E51}.Debug|Any CPU.Build.0 = Debug|Any CPU
{16FC2E26-8E6B-4D4A-8330-7639D4039E51}.Release|Any CPU.ActiveCfg = Release|Any CPU
{16FC2E26-8E6B-4D4A-8330-7639D4039E51}.Release|Any CPU.Build.0 = Release|Any CPU
{642518BC-D28A-4ABC-851C-BC18CC34EEDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{642518BC-D28A-4ABC-851C-BC18CC34EEDA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{642518BC-D28A-4ABC-851C-BC18CC34EEDA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{642518BC-D28A-4ABC-851C-BC18CC34EEDA}.Release|Any CPU.Build.0 = Release|Any CPU
{AB4AD0CB-756C-444F-9F37-26DA35148934}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AB4AD0CB-756C-444F-9F37-26DA35148934}.Release|Any CPU.Build.0 = Release|Any CPU
{AB4AD0CB-756C-444F-9F37-26DA35148934}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AB4AD0CB-756C-444F-9F37-26DA35148934}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A0CAC199-457E-4862-AF9E-971C7A77CBF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A0CAC199-457E-4862-AF9E-971C7A77CBF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A0CAC199-457E-4862-AF9E-971C7A77CBF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A0CAC199-457E-4862-AF9E-971C7A77CBF9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -138,7 +150,9 @@ Global
{CF670F4A-49DD-4030-A4A0-1F4D600EB70A} = {503AB075-7C23-475B-BF7D-E7F751A31536}
{66E1914C-9E10-4B28-915E-AB3773EFDAB2} = {E472BDF5-61F1-461D-872B-9F53BB3ACA80}
{33B11279-DA4A-46EA-99BF-9DEDCAC50D95} = {66E1914C-9E10-4B28-915E-AB3773EFDAB2}
{16FC2E26-8E6B-4D4A-8330-7639D4039E51} = {D2012971-32BB-4C5F-BFC4-30A9994AB152}
{642518BC-D28A-4ABC-851C-BC18CC34EEDA} = {D2012971-32BB-4C5F-BFC4-30A9994AB152}
{AB4AD0CB-756C-444F-9F37-26DA35148934} = {E472BDF5-61F1-461D-872B-9F53BB3ACA80}
{A0CAC199-457E-4862-AF9E-971C7A77CBF9} = {D2012971-32BB-4C5F-BFC4-30A9994AB152}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {24BEC44B-92B0-43AA-9B15-163459D0C098}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
using MongoDB.Bson;
using MongoDB.Bson.TestHelpers;
using MongoDB.Driver;
using MongoDB.Driver.Core.Clusters;
using MongoDB.Driver.Encryption;
using MongoDB.Driver.TestHelpers;
using MongoDB.Libmongocrypt;
Expand All @@ -34,15 +33,16 @@ public class LibmongocryptBindingBenchmark

private byte[] _encryptedValuesDocumentBytes;
private DisposableMongoClient _disposableKeyVaultClient;
private AutoEncryptionLibMongoCryptController _libMongoCryptController;
private CryptClient _cryptClient;
private IAutoEncryptionLibMongoCryptController _libMongoCryptController;

[Params(1, 2, 8, 64)]
[Params(1)]
public int ThreadsCount { get; set; }

[GlobalSetup]
public void Setup()
{
MongoClientSettings.Extensions.AddAutoEncryption();

var localMasterKey = Convert.FromBase64String(LocalMasterKey);

var kmsProviders = new Dictionary<string, IReadOnlyDictionary<string, object>>();
Expand Down Expand Up @@ -92,8 +92,8 @@ public void Setup()
_encryptedValuesDocumentBytes = encryptedValuesDocument.ToBson();

// Create libmongocrypt binding that will be used for decryption
_cryptClient = CryptClientCreator.CreateCryptClient(autoEncryptionOptions.ToCryptClientSettings());
_libMongoCryptController = AutoEncryptionLibMongoCryptController.Create(_disposableKeyVaultClient, _cryptClient, autoEncryptionOptions);
_libMongoCryptController =
MongoClientSettings.Extensions.AutoEncryptionProvider.CreateAutoCryptClientController(_disposableKeyVaultClient, autoEncryptionOptions);
}

[Benchmark]
Expand All @@ -111,7 +111,7 @@ public void BulkDecryptionUsingBinding()
[GlobalCleanup]
public void Cleanup()
{
_cryptClient.Dispose();
_libMongoCryptController.Dispose();
_disposableKeyVaultClient.Dispose();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

<ItemGroup>
<ProjectReference Include="..\..\src\MongoDB.Driver\MongoDB.Driver.csproj" />
<ProjectReference Include="..\..\src\MongoDB.Libmongocrypt\MongoDB.Libmongocrypt.csproj" />
<ProjectReference Include="..\..\tests\MongoDB.Driver.TestHelpers\MongoDB.Driver.TestHelpers.csproj" />
</ItemGroup>
</Project>
Loading

0 comments on commit 5e1f3fd

Please sign in to comment.