def unpack(self, data: bytes) -> bytes: ticket_lifetime_int = PackableInt(4, 0) data = ticket_lifetime_int.unpack(data) self.ticket_lifetime = ticket_lifetime_int.value ticket_age_add_int = PackableInt(4, 0) data = ticket_age_add_int.unpack(data) self.ticket_age_add = ticket_age_add_int.value ticket_nonce_vec = Vector(1) data = ticket_nonce_vec.unpack(data) self.ticket_nonce = ticket_nonce_vec.data ticket_vec = Vector(2) data = ticket_vec.unpack(data) self.ticket = ticket_vec.data ext_vec = Vector(2) data = ext_vec.unpack(data) ext_data: bytes = ext_vec.data extensions = [] while len(ext_data) > 0: ext = Extension() ext_data = ext.unpack(ext_data) extension = Extension.construct(ext.ext_type) if extension: ext.ext: Vector extension.unpack(ext.ext.data) ext.ext = extension extensions.append(ext) self.extensions = tuple(extensions) return data
def unpack(self, data: bytes) -> bytes: legacy_version_int = ProtocolVersion(0) data = legacy_version_int.unpack(data) self.legacy_version = legacy_version_int.value assert len(data) >= 32, f"no enough bytes to unpack random" self.random = data[:32] data = data[32:] legacy_session_id_echo_vec = Vector(1) data = legacy_session_id_echo_vec.unpack(data) self.legacy_session_id_echo = legacy_session_id_echo_vec.data self.cipher_suite, data = CipherSuite.unpack(data) self.legacy_compression_method, data = CompressionMethod.unpack(data) extension_vec = Vector(2) data = extension_vec.unpack(data) ext_data: bytes = extension_vec.data extensions = [] while len(ext_data) > 0: ext = Extension() ext_data = ext.unpack(ext_data) extension = Extension.construct(ext.ext_type) if extension: ext.ext: Vector extension.unpack(ext.ext.data) ext.ext = extension extensions.append(ext) self.extensions = tuple(extensions) return data
def unpack(self, data: bytes) -> bytes: cert_req_ctx_vec = Vector(1) data = cert_req_ctx_vec.unpack(data) self.cert_req_ctx = cert_req_ctx_vec.data cert_entries_vec = Vector(3) data = cert_entries_vec.unpack(data) cert_entries_data: bytes = cert_entries_vec.data cert_entries = [] while len(cert_entries_data) > 0: cert_entry = CertificateEntry() cert_entries_data = cert_entry.unpack(cert_entries_data) cert_entries.append(cert_entry) self.cert_entries = tuple(cert_entries) return data
def unpack(self, data: bytes) -> bytes: cert_data_vec = Vector(3) data = cert_data_vec.unpack(data) self.cert_data = cert_data_vec.data ext_data_vec = Vector(2) data = ext_data_vec.unpack(data) ext_data: bytes = ext_data_vec.data extensions = [] while len(ext_data) > 0: ext = Extension() ext_data = ext.unpack(ext_data) extensions.append(ext) self.extensions = tuple(extensions) return data
def unpack(self, data: bytes) -> bytes: cert_req_ctx_vvc = Vector(1) data = cert_req_ctx_vvc.unpack(data) self.certificate_request_context = cert_req_ctx_vvc.data extension_vec = Vector(2) data = extension_vec.unpack(data) ext_data: bytes = extension_vec.data extensions = [] while len(ext_data) > 0: ext = Extension() ext_data = ext.unpack(ext_data) extensions.append(ext) self.extensions = tuple(extensions) return data
def unpack(self, data: bytes) -> bytes: extension_vec = Vector(2) data = extension_vec.unpack(data) ext_data: bytes = extension_vec.data extensions = [] while len(ext_data) > 0: ext = Extension() ext_data = ext.unpack(ext_data) extension = Extension.construct(ext.ext_type) if extension: ext.ext: Vector extension.unpack(ext.ext.data) ext.ext = extension extensions.append(ext) extensions = [] self.extensions = tuple(extensions) return data
def unpack(self, data: bytes) -> bytes: self.algorithm, data = SignatureScheme.unpack(data) signature_vec = Vector(2) data = signature_vec.unpack(data) self.signature = signature_vec.data return data
def unpack(self, data: bytes) -> bytes: self.key_exchange.group, data = NamedGroup.unpack(data) key_exchange_vec = Vector(2) data = key_exchange_vec.unpack(data) self.key_exchange.unpack(key_exchange_vec.data) return data