From f47b458f2a8e154624d73d58cd9fbfca72e0a89d Mon Sep 17 00:00:00 2001 From: Alistair Evans Date: Fri, 4 Feb 2022 15:41:43 +0000 Subject: [PATCH] Don't depend on enclave for RNG, just use the built-in .NET one --- src/Enclave.ARSoft.Tools.Net/Dns/DnsClientBase.cs | 6 ++---- .../Enclave.ARSoft.Tools.Net.csproj | 3 --- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/Enclave.ARSoft.Tools.Net/Dns/DnsClientBase.cs b/src/Enclave.ARSoft.Tools.Net/Dns/DnsClientBase.cs index fb48ea3..7498bd8 100644 --- a/src/Enclave.ARSoft.Tools.Net/Dns/DnsClientBase.cs +++ b/src/Enclave.ARSoft.Tools.Net/Dns/DnsClientBase.cs @@ -25,16 +25,14 @@ using System.Net; using System.Net.NetworkInformation; using System.Net.Sockets; +using System.Security.Cryptography; using System.Threading; using System.Threading.Tasks; -using Enclave.Sdk.Security; namespace ARSoft.Tools.Net.Dns { public abstract class DnsClientBase { - private static readonly IRngSecure _secureRandom = RngSecure.Shared; - private readonly List _servers; private readonly bool _isAnyServerMulticast; private readonly int _port; @@ -263,7 +261,7 @@ private void PrepareMessage(TMessage message, out int messageLength, o { if (message.TransactionID == 0) { - message.TransactionID = (ushort) BinaryPrimitives.ReadUInt16LittleEndian(_secureRandom.GetRandomBits(sizeof(ushort) * 8)); + message.TransactionID = (ushort) RandomNumberGenerator.GetInt32(0, 0xffff); } if (Is0x20ValidationEnabled) diff --git a/src/Enclave.ARSoft.Tools.Net/Enclave.ARSoft.Tools.Net.csproj b/src/Enclave.ARSoft.Tools.Net/Enclave.ARSoft.Tools.Net.csproj index e472907..64f42ab 100644 --- a/src/Enclave.ARSoft.Tools.Net/Enclave.ARSoft.Tools.Net.csproj +++ b/src/Enclave.ARSoft.Tools.Net/Enclave.ARSoft.Tools.Net.csproj @@ -15,7 +15,4 @@ Always - - - \ No newline at end of file