(self, private_key, key)
Check if key is valid, then generate a shared
           secret with it
Check if key is valid, then generate a shared
           secret with it
Check if key is valid then generate a shared secret with it
def generate_secret(self, private_key, key):
        """Check if key is valid, then generate a shared
           secret with it
        """
        if self.check_pubkey(key):
            # valid pubkey
            secret = pow(key, private_key, self.prime)
            return secret
def generate_secret ( self , private_key , key ) : if self . check_pubkey ( key ) : # valid pubkey secret = pow ( key , private_key , self . prime ) return secret