def transport_channel_id(transport, is_server, channel_id_type):
 if (channel_id_type is None):
  return None
 if (channel_id_type not in [u'tls-unique']):
  raise Exception('invalid channel ID type {}'.format(channel_id_type))
 if hasattr(transport, '_tlsConnection'):
  if is_server:
   tls_finished_msg = transport._tlsConnection.get_peer_finished()
  else:
   tls_finished_msg = transport._tlsConnection.get_finished()
  m = hashlib.sha256()
  m.update(tls_finished_msg)
  return m.digest()
 else:
  return None

def transport_channel_id ( transport , is_server , channel_id_type ) : if ( channel_id_type is None ) : return None if ( channel_id_type not in [ u'tls-unique' ] ) : raise Exception ( 'invalid channel ID type {}' . format ( channel_id_type ) ) if hasattr ( transport , '_tlsConnection' ) : if is_server : tls_finished_msg = transport . _tlsConnection . get_peer_finished ( ) else : tls_finished_msg = transport . _tlsConnection . get_finished ( ) m = hashlib . sha256 ( ) m . update ( tls_finished_msg ) return m . digest ( ) else : return None
application-layer user authentication protocols are vulnerable to generic credential forwarding attacks .