Shared file cannot be opened - DecryptionFailedException problem

Steps to reproduce

  1. User uploaded file
  2. Shared this file
  3. Shared file cannot be opened

My comments

Basically since the beginning of this sharedfilename.xlsx was uploaded into server there are DecryptionFailedException log entries (altogether 17 same entries).
User has keys (filekey and ShareKey) in
data/$user/files_encryption/keys/files/$path_to_file/OC_DEFAULT_MODULE/ folder

I found similar issue - Unable to decrypt files on 8.2.2. There are suggested lots of different solutions along the process - patching, updating, changing oc_filecache. So I'm wondering - is there one solution or should I patch or update, and then hope that everything will be fixed.

ownCloud log (data/owncloud.log)

{"reqId":"1Q9Mb0CkXqjN3iBUmHv0",
	"remoteAddr":"10.10.10.10",
	"app":"no app in context",
	"message":"Encryption module \"Default encryption module\" is not able to read \/u.username\/files\sharedfilename.xlsx",
	"level":2,
	"time":"2016-10-17T09:47:01+02:00"
	}
{"reqId":"1Q9Mb0CkXqjN3iBUmHv0",
	"remoteAddr":"10.10.10.10",
	"app":"no app in context",
	"message":"Exception: {\"Exception\":\"OC\\\\Encryption\\\\Exceptions\\\\DecryptionFailedException\",
		"Message\":\"Encryption module \\\"Default encryption module\\\" is not able to read \\\/u.username\\\/files\\\/files\sharedfilename.xlsx\",
		"Code\":0,\"Trace\":
			#0 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/wrapper\\\/encryption.php(289): OCA\\\\Encryption\\\\Crypto\\\\Encryption->isReadable('\\\/u.username\\\/fi...', 'u.username2')
			#1 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/wrapper\\\/wrapper.php(161): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Encryption->isReadable('files\\\/sharedfilename...')
			#2 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_sharing\\\/lib\\\/sharedstorage.php(256): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->isReadable('files\\\/sharedfilename...')
			#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/wrapper\\\/wrapper.php(161): OC\\\\Files\\\\Storage\\\\Shared->isReadable('')
			#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/wrapper\\\/availability.php(170): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->isReadable('')
			#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/wrapper\\\/wrapper.php(161): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Availability->isReadable('')
			#6 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/view.php(1023): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->isReadable('')
			#7 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/view.php(399): OC\\\\Files\\\\View->basicOperation('isReadable', '\\\/\\\//sharedfilename...')
			#8 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/filesystem.php(672): OC\\\\Files\\\\View->isReadable('\\\/\\\/sharedfilename...')
			#9 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files.php(164): OC\\\\Files\\\\Filesystem::isReadable('\\\/\\\/sharedfilename...')
			#10 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files.php(90): OC_Files::getSingleFile(Object(OC\\\\Files\\\\View), '\\\/', '/sharedfilename...', false)
			#11 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files\\\/ajax\\\/download.php(53): OC_Files::get('\\\/', Array, false)
			#12 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/route\\\/route.php(154) : runtime-created function(1): require_once('\\\/var\\\/www\\\/ownclo...')
			#13 [internal function]: __lambda_func(Array)
			#14 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/route\\\/router.php(291): call_user_func('\\\\x00lambda_10904', Array)
			#15 \\\/var\\\/www\\\/owncloud\\\/lib\\\/base.php(851): OC\\\\Route\\\\Router->match('\\\/apps\\\/files\\\/aja...')
			#16 \\\/var\\\/www\\\/owncloud\\\/index.php(39): OC::handleRequest()
			#17 {main}\",
		"File\":\"\\\/var\\\/www\\\/owncloud\\\/apps\\\/encryption\\\/lib\\\/crypto\\\/encryption.php\",
		"Line\":431}",
	"level":3,
	"time":"2016-10-17T09:47:01+02:00"
	}

Are you using encryption: yes/no
yes

Server configuration

Operating system:
Debian 8
Web server:
nginx 1.8
Database:
mysql 5.6
PHP version:
php 5.6
ownCloud version: (see ownCloud admin page)
ownCloud 8.2.2
Updated from an older ownCloud or fresh install:
ownCloud 8.1

Hi,

as already pointed out in your github issue you really need to upgrade to at least 8.2.8 first before searching for issues in an outdated oC version which might be already fixed in newer versions.

Hi,

Thanks for reply.
As I understand you say that upgrading only fixes things and doesn't make things worse - it may create new problems but older problems probably are fixed?

Hi,

yes older existing problems might be fixed. As you can see that there is a huge list of fixes between your used 8.2.2 and the current 8.2.8 no one can guess / remember if your actual issue was fixed. Thats the reason why you should always stay on one of the latest releases like 8.2.8/9.0.5 or 9.1.1.