MCPcopy Create free account
hub / github.com/secdev/scapy / should_add_ServerHello

Method should_add_ServerHello

scapy/layers/tls/automaton_srv.py:367–387  ·  view source on GitHub ↗

Selecting a cipher suite should be no trouble as we already caught the None case previously.

(self)

Source from the content-addressed store, hash-verified

365
366 @ATMT.condition(PREPARE_SERVERFLIGHT1)
367 def should_add_ServerHello(self):
368 """
369 Selecting a cipher suite should be no trouble as we already caught
370 the None case previously.
371 """
372 if isinstance(self.mykey, PrivKeyRSA):
373 kx = "RSA"
374 elif isinstance(self.mykey, PrivKeyECDSA):
375 kx = "ECDSA"
376 elif isinstance(self.mykey, PrivKeyEdDSA):
377 kx = ""
378 usable_suites = get_usable_ciphersuites(self.cur_pkt.ciphers, kx)
379 c = usable_suites[0]
380 if self.preferred_ciphersuite in usable_suites:
381 c = self.preferred_ciphersuite
382
383 # Some extensions
384 ext = [TLS_Ext_RenegotiationInfo()]
385
386 self.add_msg(TLSServerHello(cipher=c, ext=ext))
387 raise self.ADDED_SERVERHELLO()
388
389 @ATMT.state()
390 def ADDED_SERVERHELLO(self):

Callers

nothing calls this directly

Calls 5

ADDED_SERVERHELLOMethod · 0.95
get_usable_ciphersuitesFunction · 0.90
TLSServerHelloClass · 0.90
add_msgMethod · 0.80

Tested by

no test coverage detected