TLS public key must be positive

This commit is contained in:
Wizou 2022-01-13 03:06:22 +01:00
parent 145ade4414
commit 6882e85fe1
2 changed files with 3 additions and 1 deletions

View file

@ -14,7 +14,8 @@ namespace WTelegram
public static Action<int, string> Log { get; set; } = DefaultLogger;
/// <summary>For serializing indented Json with fields included</summary>
public static readonly JsonSerializerOptions JsonOptions = new() { IncludeFields = true, WriteIndented = true, IgnoreReadOnlyProperties = true };
public static readonly JsonSerializerOptions JsonOptions = new() { IncludeFields = true, WriteIndented = true,
IgnoreReadOnlyProperties = true, DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull };
private static readonly ConsoleColor[] LogLevelToColor = new[] { ConsoleColor.DarkGray, ConsoleColor.DarkCyan, ConsoleColor.Cyan,
ConsoleColor.Yellow, ConsoleColor.Red, ConsoleColor.Magenta, ConsoleColor.DarkBlue };

View file

@ -143,6 +143,7 @@ namespace WTelegram
buffer[142 + dlen] = buffer[143 + dlen] = greases[4];
buffer[219 + dlen] = buffer[220 + dlen] = greases[4];
Encryption.RNG.GetBytes(buffer, 228 + dlen, 32); // public key
buffer[228 + dlen + 31] &= 0x7F; // must be positive
TlsClientHello4.CopyTo(buffer, 260 + dlen);
buffer[271 + dlen] = buffer[272 + dlen] = greases[6];
buffer[288 + dlen] = buffer[289 + dlen] = greases[3];