Kodi Community Forum

Full Version: (beta) Password Storage
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
A password storage module that stores passwords to the platforms encrypted keyring if available or an internal encrypted keyring.

This perhaps will eventually be most useful to other addon developers, but currently only resides on my repository while I'm testing it.

I would appreciate any users who would be willing to test it (especially OSX, iOS and Raspberry Pi users) and post the results here. It shows up under 'Programs' and running it will display some info about the keyring and a button to display errors and a button for options if the internal keyring is used. The platform you are actually using, the reported plaform, keyring name and any errors would be useful information.

It is currently only used by the latest versions of my Facebook-Media and Forum Browser addons which are also on my repository.

In case you missed it, here's the link to my repository: http://ruuks-repo.googlecode.com/files/r...-1.0.0.zip.

A note to addon developers:

While not useful to anyone else now, when I've done enough testing and gotten some feedback I plan to add this to the Official repository.

Here's some basic usage info:

import passwordStorage

username = 'ruuk'
password = 'password'

retrieved_password = passwordStorage.retrieve(username)

The default behavior of retrieve() is to ask for the password if none is stored. This can be overridden with ask_on_fail=False:

retrieved_password = passwordStorage.retrieve(username,ask_on_fail=False)

The ask prompt defaults to "Enter the password for <ADDON_NAME>:" but can be overridden (and generally should) with ask_msg:

msg = "Enter the password for %s:" % username
retrieved_password = passwordStorage.retrieve(username,ask_msg=msg)

Everything else is handled by the addon. All password storage either uses the platform's encrypted storage or the internal keyring which is also encrypted.
The internal keyring requires unlocking by a passphrase at the first use in an XBMC session. The user can choose to bypass this in the Password Storage options by storing the key to disk. This actually stores a random key to disk so that a users password is never stored unencrypted. While this is still not very secure, the option is there for users who really don't want to be bothered by a request for a password.

There are also some extra functions for encrypting and decrypting data:

identifier = 'identifying label'
data = 'some test data'
encrypted_data = passwordStorage.encrypt(identifier,data)
decrypted_data = passwordStorage.decrypt(identifier,encrypted_data)

To delete a stored password:


To delete an encrypted data key:


Please feel free to make suggestions or ask questions Smile

Platforms tested so far:

    Windows XP SP3:         Windows.RegistryKeyring
    ATV2:                   Internal.PythonEncryptedKeyring
    Ouya 1.0.12:            Internal.PythonEncryptedKeyring
    OSX 10.6.3:             OS_X.Keyring
    Ubuntu 13.10/XFCE:      SecretService.Keyring
    OpenELEC 3.0 x86_64:    Internal.PythonEncryptedKeyring
    Android - SG Note 3:    Internal.PythonEncryptedKeyring
    Raspberry Pi (Raspbmc): Internal.PythonEncryptedKeyring
    iOS:                    NOT TESTED
Version 0.1.1

- Added encrypt() and decrypt() functions

On my REPO.
Version 0.1.2

- Added delete() function

On my REPO.
Version 0.1.4

- Internal keyring now defaults to storing random keyring key to disk

On my REPO.

This is less confusing to users. They can always clear it in settings if they want to increase password security.
Version 0.1.6

  • Fix for infinite loop on wrong keyring password entry
  • Added RESET KEYRING option to Password Storage manager
  • Fixes for display updates when changing password options
  • Added and improved dialogs for password retrieval failure

On my REPO.
Version 0.1.7

  • Fix for import errors on Ouya and perhaps other platforms

On my REPO.
Version 0.1.8

  • Update keyring core to most recent version
  • Fix for windows falling back to internal keyring
  • Fix for errors on OSX

On my REPO.

This should work all around now. I tested on Ouya, Win 8, OSX and Ubuntu.
Version 0.1.9

  • Remove support for SecretService keyring and Gnome keyring as they are broken because of a DBus issue with XBMC

On my REPO.