Skip to content

Commit fa00c7f

Browse files
committed
version bump
1 parent cd08e4f commit fa00c7f

5 files changed

Lines changed: 9 additions & 10 deletions

File tree

cas-dotnet-sdk/Configuration/DiffieHellmanExchange.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ public async Task CreateSharedSecretWithServer()
5858
AESWrapper aes = new AESWrapper();
5959
Aes256KeyAndNonceX25519DiffieHellman aesKey = aes.Aes256KeyNonceX25519DiffieHellman(this.SharedSecret);
6060
this.AESKey = aesKey.AesKey;
61-
this.
6261
}
6362
}
6463
}

cas-dotnet-sdk/Http/BenchmarkSender.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ private bool CanSend()
2929
{
3030
result = false;
3131
}
32-
else if (CASConfiguration.DiffieHellmanExchange?.AesNonce == null || CASConfiguration.DiffieHellmanExchange?.AesNonce?.Length == 0)
33-
{
34-
result = false;
35-
}
3632
else if (DateTime.UtcNow >= CASConfiguration.TokenCache.TokenExpiresIn)
3733
{
3834
result = false;
@@ -58,11 +54,13 @@ public async Task SendNewBenchmarkMethod(string methodName, DateTime start, Date
5854
};
5955
byte[] newBenchMarkBytes = Encoding.UTF8.GetBytes(JsonSerializer.Serialize(newBenchmarkSub));
6056
AESWrapper aesWrapper = new AESWrapper();
61-
byte[] encryptedBenchmark = aesWrapper.Aes256Encrypt(CASConfiguration.DiffieHellmanExchange.AesNonce, CASConfiguration.DiffieHellmanExchange.AESKey, newBenchMarkBytes, false);
57+
byte[] aesNonce = aesWrapper.GenerateAESNonce(false);
58+
byte[] encryptedBenchmark = aesWrapper.Aes256Encrypt(aesNonce, CASConfiguration.DiffieHellmanExchange.AESKey, newBenchMarkBytes, false);
6259
BenchmarkMacAddressSDKMethod newBenchmark = new BenchmarkMacAddressSDKMethod()
6360
{
6461
MacAddress = CASConfiguration.Networking.MacAddress,
65-
EncryptedBenchMarkSend = encryptedBenchmark
62+
EncryptedBenchMarkSend = encryptedBenchmark,
63+
AesNonce = aesNonce
6664
};
6765
httpClient.DefaultRequestHeaders.Add(Constants.HeaderNames.Authorization, CASConfiguration.TokenCache.Token);
6866
HttpResponseMessage response = await httpClient.PostAsJsonAsync(url, newBenchmark);

cas-dotnet-sdk/Symmetric/AESWrapper.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,15 +271,16 @@ public byte[] Aes128Decrypt(byte[] nonceKey, byte[] key, byte[] dataToDecrypt)
271271
/// Generates a AES Nonce usuable for AES-128-GCM and AES-256-GCM.
272272
/// </summary>
273273
/// <returns></returns>
274-
public byte[] GenerateAESNonce()
274+
public byte[] GenerateAESNonce(bool sendBenchmark = true)
275275
{
276276
DateTime start = DateTime.UtcNow;
277277
AesNonceResult nonceResult = (this._platform == OSPlatform.Linux) ? AESLinuxWrapper.aes_nonce() : AESWindowsWrapper.aes_nonce();
278278
byte[] result = new byte[nonceResult.length];
279279
Marshal.Copy(nonceResult.nonce, result, 0, nonceResult.length);
280280
FreeMemoryHelper.FreeBytesMemory(nonceResult.nonce);
281281
DateTime end = DateTime.UtcNow;
282-
this._sender.SendNewBenchmarkMethod(MethodBase.GetCurrentMethod().Name, start, end, BenchmarkMethodType.Symmetric, nameof(AESWrapper));
282+
if (sendBenchmark)
283+
this._sender.SendNewBenchmarkMethod(MethodBase.GetCurrentMethod().Name, start, end, BenchmarkMethodType.Symmetric, nameof(AESWrapper));
283284
return result;
284285
}
285286
}

cas-dotnet-sdk/Types/BenchmarkMacAddressSDKMethod.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ public class BenchmarkMacAddressSDKMethod
44
{
55
public string MacAddress { get; set; }
66
public byte[] EncryptedBenchMarkSend { get; set; }
7+
public byte[] AesNonce { get; set; }
78
public int NumberOfTries { get; set; }
89
}
910
}

cas-dotnet-sdk/cas-dotnet-sdk.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
77
<Title>cas-dotnet-sdk</Title>
88
<PackageIcon>icon.jpeg</PackageIcon>
9-
<Version>1.6.0</Version>
9+
<Version>1.7.0</Version>
1010
<Authors>Mike Mulchrone</Authors>
1111
<Description>A Nuget package that provides a implementation of the RustCrypto suite of cryptographic algorithms.</Description>
1212
<RepositoryUrl>https://github.com/Cryptographic-API-Services/cas-dotnet-sdk</RepositoryUrl>

0 commit comments

Comments
 (0)