def getSupportedKeyExchanges():
 from cryptography.hazmat.backends import default_backend
 from cryptography.hazmat.primitives.asymmetric import ec
 from twisted.conch.ssh.keys import _curveTable
 backend = default_backend()
 kexAlgorithms = _kexAlgorithms.copy()
 for keyAlgorithm in list(kexAlgorithms):
  if keyAlgorithm.startswith('ecdh'):
   keyAlgorithmDsa = keyAlgorithm.replace('ecdh', 'ecdsa')
   supported = backend.elliptic_curve_exchange_algorithm_supported(ec.ECDH(), _curveTable[keyAlgorithmDsa])
   if (not supported):
    kexAlgorithms.pop(keyAlgorithm)
 return sorted(kexAlgorithms, key=(lambda kexAlgorithm: kexAlgorithms[kexAlgorithm].preference))

def getSupportedKeyExchanges ( ) : from cryptography . hazmat . backends import default_backend from cryptography . hazmat . primitives . asymmetric import ec from twisted . conch . ssh . keys import _curveTable backend = default_backend ( ) kexAlgorithms = _kexAlgorithms . copy ( ) for keyAlgorithm in list ( kexAlgorithms ) : if keyAlgorithm . startswith ( 'ecdh' ) : keyAlgorithmDsa = keyAlgorithm . replace ( 'ecdh' , 'ecdsa' ) supported = backend . elliptic_curve_exchange_algorithm_supported ( ec . ECDH ( ) , _curveTable [ keyAlgorithmDsa ] ) if ( not supported ) : kexAlgorithms . pop ( keyAlgorithm ) return sorted ( kexAlgorithms , key = ( lambda kexAlgorithm : kexAlgorithms [ kexAlgorithm ] . preference ) )
get a list of supported key exchange algorithm names in order of preference .