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

Function get_usable_ciphersuites

scapy/layers/tls/crypto/suites.py:1299–1318  ·  view source on GitHub ↗

From a list of proposed ciphersuites, this function returns a list of usable cipher suites, i.e. for which key exchange, cipher and hash algorithms are known to be implemented and usable in current version of the TLS extension. The order of the cipher suites in the list returned by

(li, kx)

Source from the content-addressed store, hash-verified

1297
1298
1299def get_usable_ciphersuites(li, kx):
1300 """
1301 From a list of proposed ciphersuites, this function returns a list of
1302 usable cipher suites, i.e. for which key exchange, cipher and hash
1303 algorithms are known to be implemented and usable in current version of the
1304 TLS extension. The order of the cipher suites in the list returned by the
1305 function matches the one of the proposal.
1306 """
1307 res = []
1308 for c in li:
1309 if c in _tls_cipher_suites_cls:
1310 cipher = _tls_cipher_suites_cls[c]
1311 if cipher.usable:
1312 # XXX select among RSA and ECDSA cipher suites
1313 # according to the key(s) the server was given
1314 if (cipher.kx_alg.anonymous or
1315 kx in cipher.kx_alg.name or
1316 cipher.kx_alg.name == "TLS13"):
1317 res.append(c)
1318 return res

Callers 5

HANDLED_CLIENTHELLOMethod · 0.90
post_buildMethod · 0.90

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…