Server-side encryption error

Hi there!

I did a fresh installation of latest Nextcloud on Ubuntu Server, set up everything and today I switched server-side encryption on. Now when I want to upload any file i get an error message:

Encryption not ready: multikeyencryption failed error:0480006C:PEM routines::no start line

Could you help me please?

There are two aditional logs:

> [no app in context] Error: OCA\Encryption\Exceptions\MultiKeyEncryptException: multikeyencryption failed error:0480006C:PEM routines::no start line at <<closure>>
> 
>  0. /var/www/nextcloud/apps/encryption/lib/Crypto/Encryption.php line 291
>     OCA\Encryption\Crypto\Crypt->multiKeyEncrypt("*** sensitive parameters replaced ***")
>  1. /var/www/nextcloud/lib/private/Files/Stream/Encryption.php line 454
>     OCA\Encryption\Crypto\Encryption->end()
>  2. <<closure>>
>     OC\Files\Stream\Encryption->stream_close()
>  3. /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php line 1081
>     fclose()
>  4. /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php line 647
>     OC\Files\Storage\Wrapper\Encryption->writeStream()
>  5. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php line 248
>     OC\Files\Storage\Wrapper\Wrapper->writeStream()
>  6. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php line 164
>     OCA\DAV\Connector\Sabre\File->put()
>  7. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1098
>     OCA\DAV\Connector\Sabre\Directory->createFile()
>  8. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 504
>     Sabre\DAV\Server->createFile()
>  9. /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
>     Sabre\DAV\CorePlugin->httpPut()
> 10. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 472
>     Sabre\DAV\Server->emit()
> 11. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 253
>     Sabre\DAV\Server->invokeMethod()
> 12. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 321
>     Sabre\DAV\Server->start()
> 13. /var/www/nextcloud/apps/dav/appinfo/v1/webdav.php line 83
>     Sabre\DAV\Server->exec()
> 14. /var/www/nextcloud/remote.php line 166
>     require_once("/var/www/nextcl ... p")
> 
> PUT /remote.php/webdav/CHIL.jpg
> from 172.30.31.1 by admin at 2022-07-15T15:09:29+02:00

and the second one:

[webdav] Fatal: Sabre\DAV\Exception\ServiceUnavailable: Szyfrowanie nie jest gotowe: multikeyencryption failed error:0480006C:PEM routines::no start line at <<closure>>

0. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php line 319
   OCA\DAV\Connector\Sabre\File->convertToSabreException()
1. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php line 164
   OCA\DAV\Connector\Sabre\File->put()
2. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1098
   OCA\DAV\Connector\Sabre\Directory->createFile()
3. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 504
   Sabre\DAV\Server->createFile()
4. /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
   Sabre\DAV\CorePlugin->httpPut()
5. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 472
   Sabre\DAV\Server->emit()
6. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 253
   Sabre\DAV\Server->invokeMethod()
7. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 321
   Sabre\DAV\Server->start()
8. /var/www/nextcloud/apps/dav/appinfo/v1/webdav.php line 83
   Sabre\DAV\Server->exec()
9. /var/www/nextcloud/remote.php line 166
   require_once("/var/www/nextcl ... p")

PUT /remote.php/webdav/CHIL.jpg
from 172.30.31.1 by admin at 2022-07-15T15:09:29+02:00

Well i made some tests - set up 4 virtual machines:

  1. Ubuntu Server 22.04 with Nextcloud as a snap - server-side encryption WORKS

  2. Debian 11 with PHP7. 4 - server-side encryption WORKS

  3. Ubuntu Server 22.04 with PHP8.1 - server-side encryption DOESN’T WORK - error encryption not ready

  4. Ubuntu Server 22.04 with PHP7.4 - server-side encryption DOESN’T WORK - error encryption not ready

What version of Nextcloud? Seems all you need to do is downgrade below php 8.1
Instructions for that aplenty between the forum and the internet. Should resolve your issue.

I thought so too. And I even tried PHP downgrade but without success. As you can see in my previous post i made clean installation of Ubuntu Server with PHP7. 4 but it didn’t work either. This is something odd because on Debian 11 with PHP7.4 server-side works without any error…

PS. Nextcloud 24.0.2