Home > Net >  C # for the HTTPS access, how to modify the ClientHello?
C # for the HTTPS access, how to modify the ClientHello?

Time:11-10

C # for the HTTPS access, how to modify the ClientHello message?

We know that when an HTTPS visit, the client will first send ClientHello message

ClientHello message contents include the following:

1. The Version
Protocol version (protocol version) indicates the best protocol version client support, from low to high in turn SSLv2, SSLv3, TLSv1, TLSv1.1, TLSv1.2, TLSv1.3

2. The Random
Random number (random) field contains 32 bytes of data, of course, only 28 bytes are randomly generated; Remaining 4 byte contains additional information, affected by the client clock, 4 bytes Unix time format to record the client coordinated universal time (UTC), universal coordinated time starts from January 1, 1970 to the current moment of seconds, so time is constantly rising, by four bytes before fill in time, effectively avoid the cyclical appear as random Numbers, facilitate "random", "random" random number is used for generating symmetric key,
When shaking hands, the client and the server will provide random number, the randomness of each handshake is unique, plays an important role in authentication, it can prevent replay attack, and to confirm the integrity of the initial data exchange,

3. The Session ID
When the first connection, the session ID (session ID) field is empty, which means that the client does not hope to restore a
Existing session, in subsequent connection, this field can save session a unique identifier, the server can be found with the help of a session ID in his own cache corresponding session state,
If the Session id length has a value, for the SSL Session id length 0 ~ 2.0 16 bytes, later version to 32 bytes, this newspaper in this paper, the Session id length is 0, with the Session id, behind, there is no direct is a Cipher suit length,
The Session id is not necessarily a 32 bytes, RFC can 0 to 32 bytes, only the Session id generated by the server, the server generally USES the OpenSSL, and OpenSSL basic generate only 32 bytes of the Session id, if encounter other bytes of the Session id, do not think it is abnormal client hello,

4. Other extension information, such as: server_name, supported_groups, key_share etc.

5. List of Cipher suite (Cipher Suites), such as:

TLS_AES_128_GCM_SHA256
TLS_AES_256_GCM_SHA384
TLS_CHACHA20_POLY1305_SHA256
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
TLS_RSA_WITH_AES_128_GCM_SHA256
TLS_RSA_WITH_AES_256_GCM_SHA384
TLS_RSA_WITH_AES_128_CBC_SHA
TLS_RSA_WITH_AES_256_CBC_SHA


-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

I would like to ask is, in c # (or in other languages can also, such as c + +) during the HTTPS access, how to modify the clienthello extension information and cipher suite in the information and order?

Please answer!



The following attached with fiddler grab from chrome clienthello

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

CONNECT to a1.cnblogs.com: 443 HTTP/1.1
Host: a1.cnblogs.com: 443
Connection: keep alive -
The user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; X64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36

A SSLv3 - compatible ClientHello handshake was found. Fiddler extracted the parameters below.

Version: 3.3/1.2 (TLS)
The Random: FB 7 b E6 C1 22 F3 01 DA B9 69 8 d 2 a 7 b 5 f 9 a 53 DD 64 3 a C9 3 c B7 6 c 62 BA AF 2 b EB 0 e 74 BD
"Time" : 2073/2/1 1:01:47
SessionID: 1 a 46 0 d 8 c A8 76 19 A5 E6, E7 4 e, 5 f 93 E0 92 27 31 42 C5 E0 4 f A4 AC 4 d CD 56 AE DA 70 EF FF B6
Extensions:
Grease (0 xcaca) empty

server_name a1.cnblogs.comExtended_master_secret empty
Renegotiation_info 00
Xa0a supported_groups grease [0], x25519 x1d [0], secp256r1 [0 x17], secp384r1 x18 [0]
Ec_point_formats uncompressed (0 x0)
SessionTicket 59 32 70 78 4F 44 6D 74 70 76 4E 55 79 78 74 42 AC 87 2C CB 52 B8 06 52 07 C8 F4 C9 55 4D F6 D2 B0 5D EF 5B F4 81 46 10 22 14 63 53 65 9C 55 05 36 D0 62 F7 85 8D 63 7C C1 8B 46 B8 04 84 EE 88 52 F8 32 6F D7 DF 17 AF 0A 77 50 1B FF 60 6E 0A 0C B7 AC 24 18 E4 9B E3 3A C7 4B 5A D9 5C AB 35 BE 79 A1 2C 21 A6 E7 1D 25 F2 9A 2B B3 55 3D 65 E1 D4 1F 78 05 E6 1B 9E 2B 9B BB 84 C2 7E A5 83 10 3C 19 80 E6 E7 3D BD CE CB 15 B8 9F 4C 2B A1 18 65 29 A1 B3 F8 1D 9E 18 BA FF 74 A4 6B C3 40 3A 66 78 4C 29 6B DE 14 8A 82 50 AA 85 4B E8 38 DC 98 3F AF 29 FC 27 E9 A5 37 A3 30 24 6C B8 60
ALPN h2, HTTP/1.1
Status_request OCSP - Implicit Responder
Signature_algs ecdsa_secp256r1_sha256 rsa_pss_rsae_sha256, rsa_pkcs1_sha256 ecdsa_secp384r1_sha384, rsa_pss_rsae_sha384, rsa_pkcs1_sha384, rsa_pss_rsae_sha512, rsa_pkcs1_sha512
SignedCertTimestamp (RFC6962) empty
Key_share 29 a 0 a 00 0 01 00 00 00 00 1 d 20 E6 E2 C1 B1 04 31 AD 79 33 FD 94 9 b 8 a F9 BF 72 92 53 A6 F3 B4 1 ED B5 80 95 D2 44 DA 5 b 3 b 64
Psk_key_exchange_modes 01 01
X8a8a supported_versions grease [0], Tls1.3, Tls1.2, Tls1.1
0 x001b 02 00 02
00 grease (0 xdada)
Padding 14 null bytes
Ciphers:
[FAFA] Unrecognized cipher - See https://www.iana.org/assignments/tls-parameters/
[1301] TLS_AES_128_GCM_SHA256
[1302] TLS_AES_256_GCM_SHA384
[1303] TLS_CHACHA20_POLY1305_SHA256
[C02B] TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
[C02F] TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
[C02C] TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
[C030] TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
[CCA9] TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
[CCA8] TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
[C013] TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
[C014] TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
[009 c] TLS_RSA_WITH_AES_128_GCM_SHA256
[d] 009 TLS_RSA_WITH_AES_256_GCM_SHA384
[002] f TLS_RSA_WITH_AES_128_CBC_SHA
[0035] TLS_RSA_WITH_AES_256_CBC_SHA

Compression will:
[00] NO_COMPRESSION

CodePudding user response:

I write generally cannot pass the safety certification, such as not to FIPS,

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • C#
  • Related