Fixed after reading https://help.nextcloud.com/t/internal-error-after-app-update/68737
If anyone in the future has the problem that they get ‘Invalid signature’ or something alike after reinstalling the nextcloud application and thus changing the private key, I solved that issue by disabling the encryption module and running occ encryption:decrypt-all. WARNING: This will possibly permanently wreck your files, so I hope if you need to do this you have a backup!