'Retrieve the next public key object to offer to the server, possibly
delegating to an authentication agent if there is one.
@return: The public part of a key pair that could be used to
authenticate with the server, or L{None} if there are no more public
keys to try.
@rtype: L{twisted.conch.ssh.keys.Key} or L{None}'

def getPublicKey(self):

    if (self.agent is not None):
        return self.agent.getPublicKey()
    if self.keys:
        self.key = self.keys.pop(0)
    else:
        self.key = None
    return self.key.public()
