{"action":"created","issue":{"url":"https://api.github.com/repos/owncloud/core/issues/14472","labels_url":"https://api.github.com/repos/owncloud/core/issues/14472/labels{/name}","comments_url":"https://api.github.com/repos/owncloud/core/issues/14472/comments","events_url":"https://api.github.com/repos/owncloud/core/issues/14472/events","html_url":"https://github.com/owncloud/core/pull/14472","id":58778532,"number":14472,"title":"[WIP] encryption 2.0 app","user":{"login":"th3fallen","id":291859,"avatar_url":"https://avatars.githubusercontent.com/u/291859?v=3","gravatar_id":"","url":"https://api.github.com/users/th3fallen","html_url":"https://github.com/th3fallen","followers_url":"https://api.github.com/users/th3fallen/followers","following_url":"https://api.github.com/users/th3fallen/following{/other_user}","gists_url":"https://api.github.com/users/th3fallen/gists{/gist_id}","starred_url":"https://api.github.com/users/th3fallen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/th3fallen/subscriptions","organizations_url":"https://api.github.com/users/th3fallen/orgs","repos_url":"https://api.github.com/users/th3fallen/repos","events_url":"https://api.github.com/users/th3fallen/events{/privacy}","received_events_url":"https://api.github.com/users/th3fallen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/owncloud/core/labels/4%20-%20Developing","name":"4 - Developing","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/owncloud/core/milestones/31","html_url":"https://github.com/owncloud/core/milestones/8.1-current","labels_url":"https://api.github.com/repos/owncloud/core/milestones/31/labels","id":912160,"number":31,"title":"8.1-current","description":"","creator":{"login":"MorrisJobke","id":245432,"avatar_url":"https://avatars.githubusercontent.com/u/245432?v=3","gravatar_id":"","url":"https://api.github.com/users/MorrisJobke","html_url":"https://github.com/MorrisJobke","followers_url":"https://api.github.com/users/MorrisJobke/followers","following_url":"https://api.github.com/users/MorrisJobke/following{/other_user}","gists_url":"https://api.github.com/users/MorrisJobke/gists{/gist_id}","starred_url":"https://api.github.com/users/MorrisJobke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MorrisJobke/subscriptions","organizations_url":"https://api.github.com/users/MorrisJobke/orgs","repos_url":"https://api.github.com/users/MorrisJobke/repos","events_url":"https://api.github.com/users/MorrisJobke/events{/privacy}","received_events_url":"https://api.github.com/users/MorrisJobke/received_events","type":"User","site_admin":false},"open_issues":251,"closed_issues":631,"state":"open","created_at":"2014-12-22T12:04:01Z","updated_at":"2015-04-02T08:24:10Z","due_on":"2015-04-02T22:00:00Z","closed_at":null},"comments":79,"created_at":"2015-02-24T18:06:34Z","updated_at":"2015-04-02T11:38:03Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/owncloud/core/pulls/14472","html_url":"https://github.com/owncloud/core/pull/14472","diff_url":"https://github.com/owncloud/core/pull/14472.diff","patch_url":"https://github.com/owncloud/core/pull/14472.patch"},"body":"Depends on https://github.com/owncloud/core/pull/14376\r\n\r\nVery much in development. Please point out any missed opportunities to use new methods/interfaces @schiesbn \r\n\r\n- [ ] The encryption module needs a upgrade script to migrate the keys from the old encryption app to the new one, unfortunately we had to make some small changes to the folder structure (added by @schiesbn)\r\n\r\nTODOs:\r\n- [ ] Throw exception in case a file cannot be decrypted because enc module could not be loaded - 503 on clients\r\n- [ ] Throw exception in case a file cannot be decrypted because encryption is disabled - 503 on clients - @schiesbn this is going to be funny - as soon as there is no enc manager we have no way to detect if a file is encrypted\r\n- [ ] Throw exception if keys are missing - 503 on clients\r\n- [ ] Prevent sharing in case keys are missing\r\n\r\nTo Test:\r\n- [ ] Versions\r\n- [ ] desktop sync\r\n\r\nBroken scenarios:\r\n- [x] share by link\r\n- [ ] delete, restore from trash, download -> corrupted - workaround - https://github.com/owncloud/core/commit/f7c9066c6da0ba0efa97912bc012d63ce4b1a31b\r\n- [ ] previews in trash bin are broken - works as soon as the trash wrapper is properly in place - see https://github.com/owncloud/core/commit/f7c9066c6da0ba0efa97912bc012d63ce4b1a31b\r\n"},"comment":{"url":"https://api.github.com/repos/owncloud/core/issues/comments/88871996","html_url":"https://github.com/owncloud/core/pull/14472#issuecomment-88871996","issue_url":"https://api.github.com/repos/owncloud/core/issues/14472","id":88871996,"user":{"login":"jknockaert","id":7431682,"avatar_url":"https://avatars.githubusercontent.com/u/7431682?v=3","gravatar_id":"","url":"https://api.github.com/users/jknockaert","html_url":"https://github.com/jknockaert","followers_url":"https://api.github.com/users/jknockaert/followers","following_url":"https://api.github.com/users/jknockaert/following{/other_user}","gists_url":"https://api.github.com/users/jknockaert/gists{/gist_id}","starred_url":"https://api.github.com/users/jknockaert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jknockaert/subscriptions","organizations_url":"https://api.github.com/users/jknockaert/orgs","repos_url":"https://api.github.com/users/jknockaert/repos","events_url":"https://api.github.com/users/jknockaert/events{/privacy}","received_events_url":"https://api.github.com/users/jknockaert/received_events","type":"User","site_admin":false},"created_at":"2015-04-02T11:38:03Z","updated_at":"2015-04-02T11:38:03Z","body":"@DeepDiver1975 OK, I think the mistake is where flush() is called after moving the pointer in the encrypted stream; the order should be reverse. But at the same time flush() must not be called if the encrypted stream is unseekable (that why it's inside the if statement). I suggest that at https://github.com/owncloud/core/blob/feature/wipencryptionapp/lib/private/files/stream/encryption.php#L364 you save the old location `oldFilePosition=parrent::stream_tell();`, then keep the current if statement as a check for seekability of the encrypted stream, and conditionally move back the pointer before `$this->flush();` at https://github.com/owncloud/core/blob/feature/wipencryptionapp/lib/private/files/stream/encryption.php#366 using `parent::stream_seek($oldFilePosition);` and then again to the new position after `$this->flush();` using `parent::stream_seek($newFilePosition);`. Can you test this?"}}