The file encrypt module allows you to encrypt files uploaded via Drupal using the encrypt and key modules. When the files are requested, they'll get decrypted automatically.
Configure file encrypt
Ideally first configure a different path at which the encrypted files should be stored. Similar to private files you need an entry in settings.php for that:
$settings['encrypted_file_path'] = '';
The next step is to go to your file/image field settings and click on "field settings". Under upload destination choose 'Encrypted files'.
Encrypt file metadata
For encrypting metadata like title and description use the field_encrypt method. @TODO
The overall architecture contains of one key compoment: an
wrapper. It supports URLs looking like
\Drupal\file_encrypt\EncryptStreamWrapper::stream_close it writes encrypted data to the filesystem.
\Drupal\file_encrypt\EncryptStreamWrapper::stream_open it reades encrypted data and decrypts it.
On top of that the module registers a route on
passes along the profile and filepath to the stream wrapper. This allows to use
the stream wrapper via HTTP.