1
0
mirror of https://github.com/oliverbooth/TcpDotNet synced 2024-11-09 23:25:42 +00:00

perf: use static RandomNumberGenerator to generate AES key

This commit is contained in:
Oliver Booth 2024-02-12 17:59:54 +00:00
parent ff78acfb56
commit 18b0ff3f25
Signed by: oliverbooth
GPG Key ID: E60B570D1B7557B5

View File

@ -113,8 +113,7 @@ public sealed class ProtocolClient : ClientNode
byte[] encryptedPayload = rsa.Encrypt(encryptionRequest.Payload, true);
var key = new byte[128];
using var rng = new RNGCryptoServiceProvider();
rng.GetBytes(key);
RandomNumberGenerator.Fill(key);
Aes = CryptographyUtils.GenerateAes(key);
byte[] aesKey = rsa.Encrypt(key, true);