private static ProtocolVersion GetUnknownVersion(int major, int minor, string prefix) { TlsUtilities.CheckUint8(major); TlsUtilities.CheckUint8(minor); int num = major << 8 | minor; string str = Platform.ToUpperInvariant(Convert.ToString(65536 | num, 16).Substring(1)); return(new ProtocolVersion(num, prefix + " 0x" + str)); }
private static ProtocolVersion GetUnknownVersion(int major, int minor, string prefix) { TlsUtilities.CheckUint8(major); TlsUtilities.CheckUint8(minor); int v = (major << 8) | minor; string str = Platform.ToUpperInvariant(Convert.ToString((int)(0x10000 | v), 0x10).Substring(1)); return(new ProtocolVersion(v, prefix + " 0x" + str)); }
private static ProtocolVersion GetUnknownVersion(int major, int minor, string prefix) { TlsUtilities.CheckUint8(major); TlsUtilities.CheckUint8(minor); int v = (major << 8) | minor; String hex = Org.BouncyCastle.Utilities.Platform.ToUpperInvariant(Convert.ToString(0x10000 | v, 16).Substring(1)); return(new ProtocolVersion(v, prefix + " 0x" + hex)); }
protected static byte[] PatchClientHelloWithCookie(byte[] clientHelloBody, byte[] cookie) { int num = 34; int num2 = (int)TlsUtilities.ReadUint8(clientHelloBody, num); int num3 = num + 1 + num2; int num4 = num3 + 1; byte[] array = new byte[clientHelloBody.Length + cookie.Length]; Array.Copy(clientHelloBody, 0, array, 0, num3); TlsUtilities.CheckUint8(cookie.Length); TlsUtilities.WriteUint8((byte)cookie.Length, array, num3); Array.Copy(cookie, 0, array, num4, cookie.Length); Array.Copy(clientHelloBody, num4, array, num4 + cookie.Length, clientHelloBody.Length - num4); return(array); }
protected static byte[] PatchClientHelloWithCookie(byte[] clientHelloBody, byte[] cookie) { int sessionIDPos = 34; int sessionIDLength = TlsUtilities.ReadUint8(clientHelloBody, sessionIDPos); int cookieLengthPos = sessionIDPos + 1 + sessionIDLength; int cookiePos = cookieLengthPos + 1; byte[] patched = new byte[clientHelloBody.Length + cookie.Length]; Array.Copy(clientHelloBody, 0, patched, 0, cookieLengthPos); TlsUtilities.CheckUint8(cookie.Length); TlsUtilities.WriteUint8((byte)cookie.Length, patched, cookieLengthPos); Array.Copy(cookie, 0, patched, cookiePos, cookie.Length); Array.Copy(clientHelloBody, cookiePos, patched, cookiePos + cookie.Length, clientHelloBody.Length - cookiePos); return(patched); }