def parse_tls_str_list(data: bytes):
    """Parse a TLS-encoded list of strings.

    Returns
    -------
    entries : list[str]
        List of entries extracted from the TLS-encoded list.
    size : int
        Total size, in bytes, of the list.
    """
    off = 0
    header_size = struct.calcsize("!H")
    (list_length, ) = struct.unpack_from("!H", data, off)
    off += header_size
    if list_length > len(data) - off:
        raise Exception("TLS list of strings too long")

    entries = []
    while off - header_size < list_length:
        (strlen, ) = struct.unpack_from("!B", data, off)
        off += struct.calcsize("!B")
        entries.append(data[off:off + strlen].decode())
        off += strlen

    return entries, struct.calcsize("!H") + list_length
Parse a TLS-encoded list of strings.

    Returns
    -------
    entries : list[str]
        List of entries extracted from the TLS-encoded list.
    size : int
        Total size, in bytes, of the list.
    
tests/signature.py