mrpdaemon / encfs-java

encfs-java is a Java library for accessing data in EncFS volumes
GNU Lesser General Public License v3.0
42 stars 15 forks source link

Merge inital set of enhancements to support manipulating / writing files in the volume #7

Closed aefo closed 12 years ago

aefo commented 12 years ago

changes to

- Provide methods on EncFSVolume to manipulate / work with the volume.  i.e. methods to copy, move & open as an input/output stream files in the volume
- Change the EncFSVolume class to use a "native file source/provider" helper class/interface to allow files to be loaded from different places.  The default is obviously the local file system, but I want to be able to read a EncFS volume from a webdav share remotely so I needed to change the EncFSVolume to use this helper & not restrict itself to read the native files directly.  Hopefully the change should be clearer when you see the code :-) It should also make unit testing easier as we can test the EncFSVolume without it needing to use the file system
- Refactor EncFSFileInputStream to 1) Extend from InputStream 2) Support reading the data from a supplied InputStream rather than it creating the file input stream
- Created the first cut of EncFSOutputStream
- Fixed a bug in the input stream (that I may have only created locally :-), not 100% sure) where the last byte of the input stream was getting skipped / truncated.
- Updated the tests to check that they can now actually re-write out the files they were previously just reading in.  It then checks that the new written out copy is the same as the original input file (subject to unique IV per file if the volume is using that)
- Created an file comparer utility class that you can point to a mounted encfs volume on your PC & the underlying files.  It will then recurses through both and check / validate that what it decodes from the encrypted files (both file names & contents) matches what it gets when it reads the same files but through the PC mount of the volume.  It also checks that if the files are re-written out then the encrypted contents matches.  Basically this just servers as a "super-sized" integration test to verify that it can fully read & process lots of "real world" files rather than just the small samples we added to the project.
mrpdaemon commented 12 years ago

Thanks for the work, I've merged your commits. I had to do a few bugfixes caught by my Android app, mainly because it uses the String constructor of EncFSVolume rather than the File based one, so there were a few special case additions needed for the root directory case. I've also added a test to exercise the String based constructor so we don't break that path in the future.