Migrating from S3 but unable to access some encrypted files

Recovering and migrating encrypted s3

I installed nextcloud on a system with not enough ram, which resulted in slow speeds and frequent crashes so I have not been using it as I intended to migrate to a new server. Around December 2020 it completely crashed so I restarted it (and possibly performed changes).

Now I’ve found that I am unable to access many of my encrypted files. Some folders are not showing up, but I can see they are present in the S3 bucket.

My configuration is a bit complicated because the storage is in S3.

My immediate priority is recovering access to my encrypted photos and videos.

Nextcloud version: 20.0.1
Operating system and version: Linux 5.9.0-4-cloud-amd64 #1 SMP Debian 5.9.11-1 (2020-11-27) x86_64 GNU/Linux
Apache or nginx version: 2.4.46-2
PHP version: 7.4.11

The issue you are facing:
Unable to access some encrypted files.

I have 3 S3 buckets. The primary bucket in config.php. The other buckets are configured for individual users. They are also encrypted and shared.

The output of config.php:

<?php
$CONFIG = array (
  'passwordsalt' => 'salt-present',
  'secret' => 'secret-present',
  'trusted_domains' => 
  array (
    0 => 'localhost',
  ),
  'objectstore' => 
  array (
    'class' => '\\OC\\Files\\ObjectStore\\S3',
    'arguments' => 
    array (
      'bucket' => 'main-bucket',
      'autocreate' => true,
      'key' => 'mykey',
      'secret' => 'mysecret',
      'hostname' => 'myhost',
      'use_ssl' => true,
      'region' => 'xx-xx',
    ),
  ),
  'dbtype' => 'mysql',
  'version' => '20.0.1.1',
  'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'myuser',
  'dbpassword' => 'mypassword#',
  'installed' => true,
  'instanceid' => 'myinstanceid',
  'has_rebuilt_cache' => true,
);

I hope someone is able to advise where I can find and backup the keys required to decrypt the data and how to get the decryption working again?