Prior Art

  1. gnome-keyring - password keyring
  2. ssh-agent - SSH key ring
  3. Apple Keychain


  1. To create an API by which applications acting as clients may authenticate themselves against servers without concerning themselves with the details of how the authentication is performed.
  2. To centralize the storage and representation of credentials for use by clients.
  3. To integrate with platform keyring services to be able to load credentials which have already been supplied by a user for general use on a system.


(incomplete, probably partially inconsistent)

class UsernamePassword(object):

    def __init__(self, u, p, h, po):
        self.username = u
        self.password = p = h
        self.port = po

class IKeyRing(Interface):
    Represent one or more authentication credentials for a particular client-user-facing account identifier.
    def add(credentials):
        Add the given credentials object (eg, UsernamePassword) to the key ring.

    def remove(credentials):

    def find(interface, **kwargs):
        Return all credentials which provide the given interface and have attributes matching the given kwargs.

if __name__ == '__main__':
    rings = RingCollection(GnomeKeyRing(), SSHKeyAgent())

    host = ""
    d = ClientCreator(reactor, POP3Client).connectTCP(host, 110)
    def cbConnected(pop3):
        keysDeferred = rings.find(INetworkUsernamePassword, host=host, port=110)
        def cbGotKeys(keys):
            if not keys:
                username = raw_input("Username? ")
                password = raw_input("Password? ")
                creds = UsernamePassword(username, password, host, 110)
                return creds
            return keys[0]
        return keysDeferred
Last modified 13 years ago Last modified on 01/12/09 21:07:51