create backup from all keys before recovery (oc6 backport)

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