{"action":"created","issue":{"url":"https://api.github.com/repos/owncloud/core/issues/15774","labels_url":"https://api.github.com/repos/owncloud/core/issues/15774/labels{/name}","comments_url":"https://api.github.com/repos/owncloud/core/issues/15774/comments","events_url":"https://api.github.com/repos/owncloud/core/issues/15774/events","html_url":"https://github.com/owncloud/core/pull/15774","id":69832669,"number":15774,"title":"fix encryption header error","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},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-04-21T12:23:41Z","updated_at":"2015-04-21T13:38:46Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/owncloud/core/pulls/15774","html_url":"https://github.com/owncloud/core/pull/15774","diff_url":"https://github.com/owncloud/core/pull/15774.diff","patch_url":"https://github.com/owncloud/core/pull/15774.patch"},"body":"When moving back the pointer to position 0 (using stream_seek), the pointer on the encrypted stream will be moved to the position immediately after the header. Reading the header again (invoked by stream_read) will cause an error, writing the header again (invoked by stream_write) will corrupt the file. Reading/writing the header should therefore happen when opening the file rather than upon read or write. Note that a side-effect of this PR is that empty files will still get an encryption header; I think that is OK, but it is different from how it was originally implemented.\r\n@schiesbn @PVince81 Could you pls check?"},"comment":{"url":"https://api.github.com/repos/owncloud/core/issues/comments/94796022","html_url":"https://github.com/owncloud/core/pull/15774#issuecomment-94796022","issue_url":"https://api.github.com/repos/owncloud/core/issues/15774","id":94796022,"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-21T13:38:46Z","updated_at":"2015-04-21T13:38:46Z","body":"@PVince81 OK I'll try to write three tests (r+ mode, read header error, write header error). I'll definitely wait till Jenkins is done with the current one."}}