My question was a generic one related to bootstrapping occ and/or php cli scripts, so I don’t want this topic to get sidetracked.
But to address your reply, I have been using those tools. The issue is that they only work on the files themselves outside of Nextcloud. So even though I am able to decrypt all of the files, there isn’t a straight-forward way of reimporting those files, particularly in files_versions and files_trashbin/versions back into Nextcloud.