create backup from all keys before recovery

backport of https://github.com/owncloud/core/pull/11104 with some OC6 specific changes

cc @LukasReschke @PVince81