Ok, mystery solved. After the file is encrypted for the first time, my script deletes the key file. When the file is encrypted a second time, rsyncrypto creates a new key file, and also generates a completely new encrypted output file (that is why rsync is fully transferring the file again).


If the key file is not deleted, rsyncrypto delivers the same output file, so rsync can use the rsync algorithm.


This leaves me here with one question. Is it possible to have the same encrypted file without keeping the key file on my pc ?


Thanks for the replies.






Van: Shachar Shemesh []
Verzonden: vrijdag 31 juli 2009 11:58
Aan: Jan Alphenaar
CC: 'L-rsyncrypto'
Onderwerp: Re: Partial transfer of rsyncrypto encrypted files


Jan Alphenaar wrote:



Both scenario’s you describe are the way rsync should behave, but it does not. Let me just describe how case a can be reproduced.


Take a large zip file, my file is now 100MB, and encrypt it with rsyncrypto. Now rename that file to Encrypt this file again and rename the encrypted file to Both files should be the same (except the first blocks), right ?

That really depends on whether you encrypted them using the same session key.


Hope it is a bit more clear now.





Here is what I'm testing.

dd if=/dev/urandom of=/tmp/test bs=$((1024*1024)) count=100

Create a 100MB random file.

sun@sunlap:/tmp$ rsyncrypto test test1.enc test.key /usr/share/doc/rsyncrypto/examples/tests/cert.crt
sun@sunlap:/tmp$ rsyncrypto test test2.enc test.key /usr/share/doc/rsyncrypto/examples/tests/cert.crt

Create two files which are (almost) identical. vbindiff confirms this - the two files have a different header, but several bytes into the file they become identical and remain so until the end of the file.

If this is your situation, rsyncrypto is working as advertised. If rsync does not do the expected thing with this case (for example, because it does not apply the rsync algorithm to files that start off differently but become identical in cases of partial transfers), then this is a rsync bug, and has nothing to do with rsyncrypto.


Shachar Shemesh
Lingnu Open Source Consulting Ltd.