(password, keyfile, remote = False)
return masterkey
Get a key generated from KeePass-password and -keyfile
Get a key generated from KeePass-password and -keyfile
Get a key generated from KeePass - password and - keyfile
def get_key(password, keyfile, remote = False):
    """Get a key generated from KeePass-password and -keyfile"""

    if password is None and keyfile is None:
        raise TypeError('None type not allowed')
    elif password is None:
        if remote is True:
            masterkey = get_remote_filekey(keyfile)
        else:
            masterkey = get_filekey(keyfile)
    elif password is not None and keyfile is not None:
        passwordkey = get_passwordkey(password)
        if remote is True:
            filekey = get_remote_filekey(keyfile)
        else:
            filekey = get_filekey(keyfile)
        sha = SHA256.new()
        sha.update(passwordkey+filekey)
        masterkey = sha.digest()
    else:
        masterkey = get_passwordkey(password)

    return masterkey
def get_key ( password , keyfile , remote = False ) : if password is None and keyfile is None : raise TypeError ( 'None type not allowed' ) elif password is None : if remote is True : masterkey = get_remote_filekey ( keyfile ) else : masterkey = get_filekey ( keyfile ) elif password is not None and keyfile is not None : passwordkey = get_passwordkey ( password ) if remote is True : filekey = get_remote_filekey ( keyfile ) else : filekey = get_filekey ( keyfile ) sha = SHA256 . new ( ) sha . update ( passwordkey + filekey ) masterkey = sha . digest ( ) else : masterkey = get_passwordkey ( password ) return masterkey