Skip to content

Commit 5e1f3fd

Browse files
authored
CSHARP-4912: Refactor CSFLE library to separate package (#1423)
1 parent c2a64f4 commit 5e1f3fd

File tree

140 files changed

+5779
-793
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+5779
-793
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,6 @@ packages
7676
/tools
7777
/evergreen/krb5.conf.empty
7878
.config
79+
**/*.so
80+
**/*.dylib
81+
**/*.dll

CSharpDriver.sln

+20-6
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FaasTests", "FaasTests", "{
5454
EndProject
5555
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MongoDB.Driver.LambdaTest", "tests\FaasTests\LambdaTests\MongoDB.Driver.LambdaTest\MongoDB.Driver.LambdaTest.csproj", "{33B11279-DA4A-46EA-99BF-9DEDCAC50D95}"
5656
EndProject
57-
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}"
57+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MongoDB.Libmongocrypt", "src\MongoDB.Libmongocrypt\MongoDB.Libmongocrypt.csproj", "{642518BC-D28A-4ABC-851C-BC18CC34EEDA}"
58+
EndProject
59+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MongoDB.Libmongocrypt.Tests", "tests\MongoDB.Libmongocrypt.Tests\MongoDB.Libmongocrypt.Tests.csproj", "{AB4AD0CB-756C-444F-9F37-26DA35148934}"
60+
EndProject
61+
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}"
5862
EndProject
5963
Global
6064
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -114,10 +118,18 @@ Global
114118
{33B11279-DA4A-46EA-99BF-9DEDCAC50D95}.Debug|Any CPU.Build.0 = Debug|Any CPU
115119
{33B11279-DA4A-46EA-99BF-9DEDCAC50D95}.Release|Any CPU.ActiveCfg = Release|Any CPU
116120
{33B11279-DA4A-46EA-99BF-9DEDCAC50D95}.Release|Any CPU.Build.0 = Release|Any CPU
117-
{16FC2E26-8E6B-4D4A-8330-7639D4039E51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
118-
{16FC2E26-8E6B-4D4A-8330-7639D4039E51}.Debug|Any CPU.Build.0 = Debug|Any CPU
119-
{16FC2E26-8E6B-4D4A-8330-7639D4039E51}.Release|Any CPU.ActiveCfg = Release|Any CPU
120-
{16FC2E26-8E6B-4D4A-8330-7639D4039E51}.Release|Any CPU.Build.0 = Release|Any CPU
121+
{642518BC-D28A-4ABC-851C-BC18CC34EEDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
122+
{642518BC-D28A-4ABC-851C-BC18CC34EEDA}.Debug|Any CPU.Build.0 = Debug|Any CPU
123+
{642518BC-D28A-4ABC-851C-BC18CC34EEDA}.Release|Any CPU.ActiveCfg = Release|Any CPU
124+
{642518BC-D28A-4ABC-851C-BC18CC34EEDA}.Release|Any CPU.Build.0 = Release|Any CPU
125+
{AB4AD0CB-756C-444F-9F37-26DA35148934}.Release|Any CPU.ActiveCfg = Release|Any CPU
126+
{AB4AD0CB-756C-444F-9F37-26DA35148934}.Release|Any CPU.Build.0 = Release|Any CPU
127+
{AB4AD0CB-756C-444F-9F37-26DA35148934}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
128+
{AB4AD0CB-756C-444F-9F37-26DA35148934}.Debug|Any CPU.Build.0 = Debug|Any CPU
129+
{A0CAC199-457E-4862-AF9E-971C7A77CBF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
130+
{A0CAC199-457E-4862-AF9E-971C7A77CBF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
131+
{A0CAC199-457E-4862-AF9E-971C7A77CBF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
132+
{A0CAC199-457E-4862-AF9E-971C7A77CBF9}.Release|Any CPU.Build.0 = Release|Any CPU
121133
EndGlobalSection
122134
GlobalSection(SolutionProperties) = preSolution
123135
HideSolutionNode = FALSE
@@ -138,7 +150,9 @@ Global
138150
{CF670F4A-49DD-4030-A4A0-1F4D600EB70A} = {503AB075-7C23-475B-BF7D-E7F751A31536}
139151
{66E1914C-9E10-4B28-915E-AB3773EFDAB2} = {E472BDF5-61F1-461D-872B-9F53BB3ACA80}
140152
{33B11279-DA4A-46EA-99BF-9DEDCAC50D95} = {66E1914C-9E10-4B28-915E-AB3773EFDAB2}
141-
{16FC2E26-8E6B-4D4A-8330-7639D4039E51} = {D2012971-32BB-4C5F-BFC4-30A9994AB152}
153+
{642518BC-D28A-4ABC-851C-BC18CC34EEDA} = {D2012971-32BB-4C5F-BFC4-30A9994AB152}
154+
{AB4AD0CB-756C-444F-9F37-26DA35148934} = {E472BDF5-61F1-461D-872B-9F53BB3ACA80}
155+
{A0CAC199-457E-4862-AF9E-971C7A77CBF9} = {D2012971-32BB-4C5F-BFC4-30A9994AB152}
142156
EndGlobalSection
143157
GlobalSection(ExtensibilityGlobals) = postSolution
144158
SolutionGuid = {24BEC44B-92B0-43AA-9B15-163459D0C098}

benchmarks/MongoDB.Driver.Benchmarks/LibmongocryptBindingBenchmark.cs

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
using MongoDB.Bson;
2121
using MongoDB.Bson.TestHelpers;
2222
using MongoDB.Driver;
23-
using MongoDB.Driver.Core.Clusters;
2423
using MongoDB.Driver.Encryption;
2524
using MongoDB.Driver.TestHelpers;
2625
using MongoDB.Libmongocrypt;
@@ -34,15 +33,16 @@ public class LibmongocryptBindingBenchmark
3433

3534
private byte[] _encryptedValuesDocumentBytes;
3635
private DisposableMongoClient _disposableKeyVaultClient;
37-
private AutoEncryptionLibMongoCryptController _libMongoCryptController;
38-
private CryptClient _cryptClient;
36+
private IAutoEncryptionLibMongoCryptController _libMongoCryptController;
3937

40-
[Params(1, 2, 8, 64)]
38+
[Params(1)]
4139
public int ThreadsCount { get; set; }
4240

4341
[GlobalSetup]
4442
public void Setup()
4543
{
44+
MongoClientSettings.Extensions.AddAutoEncryption();
45+
4646
var localMasterKey = Convert.FromBase64String(LocalMasterKey);
4747

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

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

9999
[Benchmark]
@@ -111,7 +111,7 @@ public void BulkDecryptionUsingBinding()
111111
[GlobalCleanup]
112112
public void Cleanup()
113113
{
114-
_cryptClient.Dispose();
114+
_libMongoCryptController.Dispose();
115115
_disposableKeyVaultClient.Dispose();
116116
}
117117
}

benchmarks/MongoDB.Driver.Benchmarks/MongoDB.Driver.Benchmarks.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
<ItemGroup>
3333
<ProjectReference Include="..\..\src\MongoDB.Driver\MongoDB.Driver.csproj" />
34+
<ProjectReference Include="..\..\src\MongoDB.Libmongocrypt\MongoDB.Libmongocrypt.csproj" />
3435
<ProjectReference Include="..\..\tests\MongoDB.Driver.TestHelpers\MongoDB.Driver.TestHelpers.csproj" />
3536
</ItemGroup>
3637
</Project>

0 commit comments

Comments
 (0)