Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
Don't depend on enclave for RNG, just use the built-in .NET one
Browse files Browse the repository at this point in the history
  • Loading branch information
enclave-alistair committed Feb 4, 2022
1 parent 1efb0b8 commit f47b458
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
6 changes: 2 additions & 4 deletions src/Enclave.ARSoft.Tools.Net/Dns/DnsClientBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<IPAddress> _servers;
private readonly bool _isAnyServerMulticast;
private readonly int _port;
Expand Down Expand Up @@ -263,7 +261,7 @@ private void PrepareMessage<TMessage>(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)
Expand Down
3 changes: 0 additions & 3 deletions src/Enclave.ARSoft.Tools.Net/Enclave.ARSoft.Tools.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,4 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Enclave.Sdk.Security" Version="3.0.0" />
</ItemGroup>
</Project>

0 comments on commit f47b458

Please sign in to comment.