コード例 #1
0
def saveKeyToDisk():
	keyring = getKeyring()
	kr = keyring.get_keyring()
	if hasattr(kr,'change_keyring_password'):
		keyring_key = internalGetpass.getRandomKey()
		kr._init_file(keyring_key)
		keyring_key = kr.change_keyring_password(keyring_key)
		
		internalGetpass.saveKeyringPass(keyring_key)
		xbmcutil.ADDON.setSetting('keyring_password',keyring_key)
コード例 #2
0
def saveKeyToDisk():
    keyring = getKeyring()
    kr = keyring.get_keyring()
    if hasattr(kr, 'change_keyring_password'):
        keyring_key = internalGetpass.getRandomKey()
        kr._init_file(keyring_key)
        keyring_key = kr.change_keyring_password(keyring_key)

        internalGetpass.saveKeyringPass(keyring_key)
        xbmcutil.ADDON.setSetting('keyring_password', keyring_key)
コード例 #3
0
def encrypt(identifier,data):
	"""
	Encrypt some data. A random key is stored in the keyring for the
	identifier specified, and then used to encrypt the data.
	The returned encrypted data is hex encoded.
	"""
	identifier += '_DATA_KEY' #To avoid collisions with usernames
	from internal.Internal import encrypt
	key = internalGetpass.getRandomKey()
	store(identifier,key)
	return encrypt(key,data)
コード例 #4
0
def encrypt(identifier, data):
    """
	Encrypt some data. A random key is stored in the keyring for the
	identifier specified, and then used to encrypt the data.
	The returned encrypted data is hex encoded.
	"""
    identifier += '_DATA_KEY'  #To avoid collisions with usernames
    from internal.Internal import encrypt
    key = internalGetpass.getRandomKey()
    store(identifier, key)
    return encrypt(key, data)
コード例 #5
0
def storeKey(store=True,kr=None):
	keyring = passwordStorage.getKeyring()
	kr = kr or keyring.get_keyring()
	if store:
		if hasattr(kr,'change_keyring_password'):
			keyring_key = internalGetpass.getRandomKey()
			try:
				keyring_key = kr.change_keyring_password(keyring_key)
			except ValueError, e:
				xbmcgui.Dialog().ok('Error','Failed to unlock keyring:','',e.message)
				return
			xbmcgui.Window(10000).setProperty('KEYRING_password',keyring_key)
			xbmcutil.ADDON.setSetting('keyring_password',keyring_key)
			xbmcgui.Dialog().ok(T(32017),T(32018))
コード例 #6
0
def storeKey(store=True, kr=None):
    keyring = passwordStorage.getKeyring()
    kr = kr or keyring.get_keyring()
    if store:
        if hasattr(kr, 'change_keyring_password'):
            keyring_key = internalGetpass.getRandomKey()
            try:
                keyring_key = kr.change_keyring_password(keyring_key)
            except ValueError, e:
                xbmcgui.Dialog().ok('Error', 'Failed to unlock keyring:', '',
                                    e.message)
                return
            xbmcgui.Window(10000).setProperty('KEYRING_password', keyring_key)
            xbmcutil.ADDON.setSetting('keyring_password', keyring_key)
            xbmcgui.Dialog().ok(T(32017), T(32018))