Check if the supplied bytes contain a full ClientHello message, and if so, parse it. Returns: - A ClientHello object on success - None, if the TLS record is not complete Raises: - A ValueError, if the passed ClientHello is invalid
(data: bytes)
| 70 | |
| 71 | |
| 72 | def parse_client_hello(data: bytes) -> ClientHello | None: |
| 73 | """ |
| 74 | Check if the supplied bytes contain a full ClientHello message, |
| 75 | and if so, parse it. |
| 76 | |
| 77 | Returns: |
| 78 | - A ClientHello object on success |
| 79 | - None, if the TLS record is not complete |
| 80 | |
| 81 | Raises: |
| 82 | - A ValueError, if the passed ClientHello is invalid |
| 83 | """ |
| 84 | # Check if ClientHello is complete |
| 85 | client_hello = get_client_hello(data) |
| 86 | if client_hello: |
| 87 | try: |
| 88 | return ClientHello(client_hello[4:]) |
| 89 | except EOFError as e: |
| 90 | raise ValueError("Invalid ClientHello") from e |
| 91 | return None |
| 92 | |
| 93 | |
| 94 | def dtls_handshake_record_contents(data: bytes) -> Iterator[bytes]: |
searching dependent graphs…