core, memory, bridge: added profile password + password encryption:

/!\ This changeset updates the database version to 2 and modify the database content!

Description:
    - new parameter General / Password to store the profile password
    - profile password is initialized with XMPP password value, it is stored hashed
    - bridge methods asyncCreateProfile/asyncConnect takes a new argument "password" (default = "")
    - bridge method asyncConnect returns a boolean (True = connection already established, False = connection initiated)
    - profile password is checked before initializing the XMPP connection

    - new private individual parameter to store the personal encryption key of each profile
    - personal key is randomly generated and encrypted with the profile password
    - personal key is decrypted after profile authentification and stored in a Sessions instance
    - personal key is used to encrypt/decrypt other passwords when they need to be retrieved/modified

    - modifying the profile password re-encrypt the personal key
    - Memory.setParam now returns a Deferred (the bridge method "setParam" is unchanged)
    - Memory.asyncGetParamA eventually decrypts the password, Memory.getParamA would fail on a password parameter

TODO:
    - if profile authentication is OK but XMPP authentication is KO, prompt the user for another XMPP password
    - fix the method "registerNewAccount" (and move it to a plugin)
    - remove bridge method "connect", sole "asyncConnect" should be used
This commit is contained in:
souliane 2014-05-07 16:02:23 +02:00
commit 0d28c03d27

View file

@ -194,16 +194,16 @@ class DbusObject(dbus.service.Object):
return self._callback("addContact", unicode(entity_jid), unicode(profile_key))
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
in_signature='s', out_signature='',
in_signature='ss', out_signature='b',
async_callbacks=('callback', 'errback'))
def asyncConnect(self, profile_key="@DEFAULT@", callback=None, errback=None):
return self._callback("asyncConnect", unicode(profile_key), callback=callback, errback=errback)
def asyncConnect(self, profile_key="@DEFAULT@", password='', callback=None, errback=None):
return self._callback("asyncConnect", unicode(profile_key), unicode(password), callback=callback, errback=errback)
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
in_signature='s', out_signature='',
in_signature='ss', out_signature='',
async_callbacks=('callback', 'errback'))
def asyncCreateProfile(self, profile, callback=None, errback=None):
return self._callback("asyncCreateProfile", unicode(profile), callback=callback, errback=errback)
def asyncCreateProfile(self, profile, password='', callback=None, errback=None):
return self._callback("asyncCreateProfile", unicode(profile), unicode(password), callback=callback, errback=errback)
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
in_signature='s', out_signature='',
@ -224,10 +224,10 @@ class DbusObject(dbus.service.Object):
return self._callback("confirmationAnswer", unicode(id), accepted, data, unicode(profile))
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
in_signature='s', out_signature='',
in_signature='ss', out_signature='b',
async_callbacks=None)
def connect(self, profile_key="@DEFAULT@"):
return self._callback("connect", unicode(profile_key))
def connect(self, profile_key="@DEFAULT@", password=''):
return self._callback("connect", unicode(profile_key), unicode(password))
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
in_signature='ss', out_signature='',