internal static string GetProtocolListAsString(byte[] arrData) { int num = ((int)arrData[0] << 8) + (int)arrData[1]; byte[] array = new byte[num]; Buffer.BlockCopy(arrData, 2, array, 0, array.Length); return(HTTPSUtilities.GetExtensionString(array)); }
private void ParseServerHelloExtension(int iExtType, byte[] arrData) { if (this._Extensions == null) { this._Extensions = new List <string>(); } if (iExtType <= 35) { switch (iExtType) { case 0: this._Extensions.Add(string.Format("\tserver_name\t{0}", Utilities.ByteArrayToString(arrData))); return; case 1: this._Extensions.Add(string.Format("\tmax_fragment_length\t{0}", Utilities.ByteArrayToString(arrData))); return; case 2: this._Extensions.Add(string.Format("\tclient_certificate_url\t{0}", Utilities.ByteArrayToString(arrData))); return; case 3: this._Extensions.Add(string.Format("\ttrusted_ca_keys\t{0}", Utilities.ByteArrayToString(arrData))); return; case 4: this._Extensions.Add(string.Format("\ttruncated_hmac\t{0}", Utilities.ByteArrayToString(arrData))); return; case 5: this._Extensions.Add(string.Format("\tstatus_request\t{0}", Utilities.ByteArrayToString(arrData))); return; case 6: this._Extensions.Add(string.Format("\tuser_mapping\t{0}", Utilities.ByteArrayToString(arrData))); return; case 7: case 8: case 15: break; case 9: this._Extensions.Add(string.Format("\tcert_type\t{0}", Utilities.ByteArrayToString(arrData))); return; case 10: this._Extensions.Add(string.Format("\telliptic_curves\t{0}", HTTPSUtilities.GetECCCurvesAsString(arrData))); return; case 11: this._Extensions.Add(string.Format("\tec_point_formats\t{0}", HTTPSUtilities.GetECCPointFormatsAsString(arrData))); return; case 12: this._Extensions.Add(string.Format("\tsrp_rfc_5054\t{0}", Utilities.ByteArrayToString(arrData))); return; case 13: this._Extensions.Add(string.Format("\tsignature_algorithms\t{0}", Utilities.ByteArrayToString(arrData))); return; case 14: this._Extensions.Add(string.Format("\tuse_srtp\t{0}", Utilities.ByteArrayToString(arrData))); return; case 16: { string protocolListAsString = HTTPSUtilities.GetProtocolListAsString(arrData); this._Extensions.Add(string.Format("\tALPN\t\t{0}", protocolListAsString)); if (protocolListAsString.Contains("spdy/")) { this.bALPNToSPDY = true; return; } return; } default: if (iExtType == 35) { this._Extensions.Add(string.Format("\tSessionTicket TLS\t{0}", Utilities.ByteArrayToString(arrData))); return; } break; } } else { if (iExtType != 13172) { if (iExtType == 30031) { this._Extensions.Add(string.Format("\tchannel_id(GoogleDraft)\t{0}", Utilities.ByteArrayToString(arrData))); return; } if (iExtType == 65281) { this._Extensions.Add(string.Format("\trenegotiation_info\t{0}", Utilities.ByteArrayToString(arrData))); return; } } else { string extensionString = HTTPSUtilities.GetExtensionString(arrData); this._Extensions.Add(string.Format("\tNextProtocolNegotiation\t{0}", extensionString)); if (extensionString.Contains("spdy/")) { this.bNPNToSPDY = true; return; } return; } } this._Extensions.Add(string.Format("\t0x{0:x4}\t\t{1}", iExtType, Utilities.ByteArrayToString(arrData))); }