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)
| 1297 | |
| 1298 | |
| 1299 | def 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 |
no test coverage detected
searching dependent graphs…