Fix moving share keys as non-owner to subdir

This fix gathers the share keys BEFORE a file is moved to make sure that
findShareKeys() is able to find all relevant keys when the file still
exists.

After the move/copy operation the keys are moved/copied to the target
dir.

Also: refactored preRename and preCopy into a single function to avoid
duplicate code.
Fix warning with unset extension check
Added encryption test when moving file as non-owner