My apologies for sending the incomplete message.<div><br></div><div><div>I used 4.0.2 to debug the encryption and found that the problem is in the <b>OC_Crypt::decrypt  - </b>it strips all 0x00 characters at the 8KB block boundary. </div>
<div>Please check the encryption with the attached files. One has 32 of 0x00 inside and another one is the same but has 0x05 at the 7th position.</div><div><br></div><div>When I change <b>apps/files_encryption/lib/crypt.php</b>  line <b>#136</b></div>
<div><span style="white-space:pre-wrap">          </span>return rtrim($data, "\0");</div><div>to </div><div><span style="white-space:pre-wrap">           </span>return $data;</div><div><br></div><div>the file is decrypted correctly except the fact that it's last block is padded with 0x00. (Tested on *.exe ~ 7MB)</div>
</div><div><br></div><div>---</div><div>Victor Dubiniuk<br><div><br><div class="gmail_quote">On Wed, Jun 13, 2012 at 6:07 PM, Victor Dubiniuk <span dir="ltr"><<a href="mailto:victor.dubiniuk@gmail.com" target="_blank">victor.dubiniuk@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<div><br></div><div>I used 4.0.  and found that the problem is in the  <b>OC_Crypt::decrypt</b></div><div>it strips all 0x00 characters at the block boundary. </div>
<div>Please check with the attached files.</div><div>
One has 32 of 0x00 inside and another one - </div><div><br></div><div>When I change <b>apps/files_encryption/lib/crypt.php</b>  line <b>#136</b></div><div><span style="white-space:pre-wrap">                </span>return rtrim($data, "\0");</div>

<div>to </div><div><span style="white-space:pre-wrap">                </span>return $data;</div><div><br></div><div>the file is decrypted correctly except the fact that it's last block is padded with 0x00.</div><div>
<br></div><div>I hope that it will be helpful.</div><div><br></div><div><br></div><div>---</div><div>Victor Dubiniuk</div><div class="HOEnZb"><div class="h5"><div><br><div class="gmail_quote">On Wed, Jun 13, 2012 at 4:45 AM, Michael Gapczynski <span dir="ltr"><<a href="mailto:mtgap@owncloud.com" target="_blank">mtgap@owncloud.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On Tuesday, June 12, 2012 12:52:06 PM Klaas Freitag wrote:<br>
> On 04.06.2012 18:33, Klaas Freitag wrote:<br>
> > On 04.06.2012 18:13, Frank Karlitschek wrote:<br>
> >> Hi,<br>
> >><br>
> >> we have a very evil bug report about corrupted files together with the<br>
> >> encryption app.<br>
> >><br>
> >> <a href="http://bugs.owncloud.org/thebuggenie/owncloud/issues/oc-912" target="_blank">http://bugs.owncloud.org/thebuggenie/owncloud/issues/oc-912</a><br>
> >> <a href="http://forum.owncloud.org/viewtopic.php?f=3&t=2726" target="_blank">http://forum.owncloud.org/viewtopic.php?f=3&t=2726</a><br>
> >><br>
> >> Everything works for me and I can´t find the problem<br>
> >> Can someone help me with reproducing it?<br>
> ><br>
> > I can reproduce it with a Firefox on Linux and on Windows 7. I have<br>
> > master running from this morning.<br>
><br>
> Frank, do you think that<br>
> <a href="http://bugs.owncloud.org/thebuggenie/owncloud/issues/oc-669" target="_blank">http://bugs.owncloud.org/thebuggenie/owncloud/issues/oc-669</a><br>
> can be related to this problem? Is there a fix already for #912?<br>
><br>
> Thanks,<br>
><br>
> Klaas<br>
<br>
</div>It seems that binary data has problems going through the encryption. I did<br>
some research and read that base64_encode()/decode() should allow binary files<br>
to be encrypted. My attempts to encode and decode the data with base64 still<br>
result in corrupted binary files.<br>
<br>
<a href="http://bytes.com/topic/php/answers/8958-binary-encryption" target="_blank">http://bytes.com/topic/php/answers/8958-binary-encryption</a><br>
<br>
<a href="http://stackoverflow.com/questions/6033972/encrypting-files-with-php-mcrypt-is-corrupting-docx-and-other-microsoft-office" target="_blank">http://stackoverflow.com/questions/6033972/encrypting-files-with-php-mcrypt-<br>


is-corrupting-docx-and-other-microsoft-office</a><br>
<br>
<a href="http://www.itnewb.com/tutorial/PHP-Encryption-Decryption-Using-the-MCrypt-Library-libmcrypt" target="_blank">http://www.itnewb.com/tutorial/PHP-Encryption-Decryption-Using-the-MCrypt-<br>
Library-libmcrypt</a><br>
<span><font color="#888888"><br>
<br>
<br>
Michael<br>
</font></span><div><div>_______________________________________________<br>
Owncloud mailing list<br>
<a href="mailto:Owncloud@kde.org" target="_blank">Owncloud@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/owncloud" target="_blank">https://mail.kde.org/mailman/listinfo/owncloud</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>