def __setattr__(self, name, val):
        """
        We have to keep the encryptor/decryptor for a long time,
        however they have to be updated every time the key is changed.
        """
        if name == "key":
            if self._cipher is not None:
                self._cipher.algorithm.key = val
                self.encryptor = self._cipher.encryptor()
                self.decryptor = self._cipher.decryptor()
            self.ready["key"] = True
        super(_StreamCipher, self).__setattr__(name, val)
def __setattr__ ( self , name , val ) : if name == "key" : if self . _cipher is not None : self . _cipher . algorithm . key = val self . encryptor = self . _cipher . encryptor ( ) self . decryptor = self . _cipher . decryptor ( ) self . ready [ "key" ] = True super ( _StreamCipher , self ) . __setattr__ ( name , val )
We have to keep the encryptor/decryptor for a long time,
        however they have to be updated every time the key is changed.