

def onHandshake(self, handshake):
    '\n        Called upon receiving the handshake request.\n\n        This checks that the given hash in C{handshake} is equal to a\n        calculated hash, responding with a handshake reply or a stream error.\n        If the handshake was ok, the stream is authorized, and  XML Stanzas may\n        be exchanged.\n        '
    calculatedHash = xmlstream.hashPassword(self.xmlstream.sid, unicode(self.secret))
    if (handshake != calculatedHash):
        exc = error.StreamError('not-authorized', text='Invalid hash')
        self.xmlstream.sendStreamError(exc)
    else:
        self.xmlstream.send('<handshake/>')
        self.xmlstream.dispatch(self.xmlstream, xmlstream.STREAM_AUTHD_EVENT)

dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/words/protocols/jabber/component.py ListenComponentAuthenticator.onHandshake/original