Commit Graph

234 Commits (dev)

Author SHA1 Message Date
Mark Pariente f46201577d Fix style 2012-03-04 00:06:26 -08:00
Mark Pariente 87ca7a109f Fix EncFSVolume.movePath() for ChainedNameIV
There was a bug in EncFSVolume.movePath() that caused recursive moves
in the case of ChainedNameIV configurations to fail. Also improved
rollback handling in the case of an error during the recursive move
by trying to delete the newly created directories.

Added a FileNotFoundException to EncFSLocalFileProvider.move()
implementation as well.
2012-03-03 23:54:29 -08:00
Mark Pariente 8b49d66127 Absolute/relative path handling in EncFSShell
This commit cleans up EncFSShell path handling to allow absolute paths
as well as relative paths with multiple path elements. For example:

/ > ls
testdir1/
/ > ls testdir1/testdir2
testdir-with-really-really-long-name/
testfile2.txt
/ > cd testdir1/testdir3/testdir4
/testdir1/testdir3/testdir4 > cat /testdir1/testfile.txt
file contents!
file contents!
...

All existing commands were improved to use the new path handling
capabilities. Cleaned up error messages in the process as well.
2012-03-03 18:50:09 -08:00
Mark Pariente 216a33901a Throw exception from EncFSLocalFileProvider.mkdir()
Made EncFSLocalFileProvider.mkdir() throw a FileNotFoundException
if one or more path elements aren't found. Also modified
EncFSVolume.makeDir to filter this exception to print the
unencrypted path in the exception message.
2012-03-03 17:33:30 -08:00
Mark Pariente e1027c3b87 Implement EncFSUtil.copyWholeStream()
Noticed we're doing full InputStream->OutputStream copies quite a bit
around the code, so this commit adds a utility function for that and
calls it from everywhere.
2012-02-29 23:59:49 -08:00
Mark Pariente 024b19dc2e Show '/' at the end of directory names 2012-02-29 23:02:34 -08:00
Mark Pariente 5f4c44ed7c Add test for zero-block passthrough 2012-02-29 21:47:30 -08:00
Mark Pariente ba773dfdb9 Implement zero-block passthrough 2012-02-29 21:22:26 -08:00
Mark Pariente f5daf6d52a Code style, formatting and API name cleanups
This is a massive commit serving a few purposes:

 * Unify code formatting and style to conform to Eclipse formatting. We
   will use this formatting from now on for all new code to have a
   uniform codebase.

 * Clean up API naming and remove redundancies. I've renamed a lot of
   API functions to promote coherence across the codebase. I've also
   removed some redundant API's to promote best practices.

 * Improve JavaDoc coverage. This commit documents all public methods
   within the library itself.

 * Fix JavaDoc warnings.
2012-02-27 23:03:14 -08:00
Mark Pariente 95183d30b1 Account for block headers in getDecodedFileInfo()
EncFSFileInfo.getDecodedFileInfo() needs to account for block headers
when calculating the size of the decoded file contents.
2012-02-26 19:26:16 -08:00
Mark Pariente aaa137d3fc Add .settings to .gitignore 2012-02-26 19:26:07 -08:00
Mark Pariente 3e825f410a Merge remote-tracking branch 'aefo/master' into master
Conflicts:
	src/main/java/org/mrpdaemon/sec/encfs/EncFSConfigWriter.java
	src/main/java/org/mrpdaemon/sec/encfs/EncFSVolume.java
	src/test/java/org/mrpdaemon/sec/encfs/EncFSVolumeTest.java
2012-02-22 21:08:52 -08:00
aefo 9625039638 Added further tests for EncFSVolume 2012-02-22 19:28:42 +00:00
Mark Pariente 2ed6748688 Get rid of the extra copies in input/output streams
The extra copy in EncFSInputStream wasn't necessary. Unfortunately the
copy in EncFSOutputStream can't be averted, but this commit moves it to
be in streamEncode() itself.
2012-02-20 22:52:24 -08:00
Mark Pariente a85ddabccb Add a version of EncFSCrypto.mac64 without length 2012-02-20 22:17:06 -08:00
Mark Pariente a4346a0263 Remove stale comment 2012-02-20 12:11:38 -08:00
Mark Pariente 7461211c01 Add support for per-block MAC headers
This commit implements the blockMACBytes and blockMACRandBytes options
that cause a header to be inserted in front of every file block
containing a MAC of the block (and optionally some random data).

Added support to EncFSConfig, EncFSConfigParser and EncFSConfigWriter
to recognize these options. Implemented the MAC computation,
verification and insertion in EncFSInputStream and EncFSOutputStream.
Added a new test volume configured with 8 bytes of MAC and 8 bytes of
random bytes as 'testvol-blockmac', and extended EncFSVolumeTest to
include a long file test that verifies the MAC computations.
2012-02-20 12:08:18 -08:00
Mark Pariente 41cae65321 Add long file tests that verify decrypted content
Added two 6000 byte files to the default and no unique IV test volumes
and added tests that verify decrypted content. These tests are useful
for testing block encryption.
2012-02-19 15:47:42 -08:00
Mark Pariente 4bb80ed120 Convert getDefaultConfig() to EncFSConfig() constructor 2012-02-19 12:40:42 -08:00
Mark Pariente e80add4f0e Don't use a random iteration count in encodeVolumeKey 2012-02-19 12:29:08 -08:00
Mark Pariente e47c694c0e createVolume() no longer instantiates EncFSVolume
Separated the step of instantiating an EncFSVolume from the
createVolume() function. This allows batch volume creation support
without having to do the associated crypto that comes with creating
an EncFSVolume object to actually use the created volume.
2012-02-19 12:13:22 -08:00
Mark Pariente 87eea27c1d Use SecureRandom instead of Random 2012-02-12 19:04:50 -08:00
Mark Pariente f2be09a789 Get rid of the unused File field in EncFSFile 2012-02-12 19:02:28 -08:00
Mark Pariente 5b5e9d7ed1 Readme update 2012-02-11 23:22:04 -08:00
Mark Pariente b4d230dac7 Volume creation support
This commit adds initial support for volume creation. A new class was
added for writing an EncFSConfig to a file (EncFSConfigWriter). Provided
utility methods for getting a default EncFSConfig and creating a new
volume with a given password and EncFSConfig.

Added a basic volume creation test which creates a temporary directory
and creates a volume within, making sure that encfs-java is able to
instantiate an EncFSVolume on it afterwards. I also made sure that the
upstream encfs implementation can read the volume created by this test
also.
2012-02-11 19:52:25 -08:00
Mark Pariente f1cb71fc4e Get rid of deprecated EncFSFile constructor
We shouldn't use the EncFSFile constructor that takes in a File any
more since we have EncFSLocalFileProvider now. This change removes
that constructor and all the EncFSVolume special casing for it.
2012-02-10 00:15:16 -08:00
Mark Pariente 1bd78ad629 EncFSCrypto code refactoring + comments
Shuffled around some methods, changed public/private attributes,
refactored some common code and added JavaDoc comments for all public
methods.
2012-02-09 23:51:32 -08:00
Mark Pariente e69353840d EncFSVolume constructor refactoring
Removed all File based constructors for EncFSVolume. Only kept the
following constructors:

EncFSVolume(String rootPath, String password)
EncFSVolume(String rootPath, byte[] passwordKey)
EncFSVolume(EncFSFileProvider fileProvider, String password)
EncFSVolume(EncFSFileProvider fileProvider, byte[] passwordKey)
EncFSVolume(EncFSFileProvider fileProvider, EncFSConfig config,
            String password)
EncFSVolume(EncFSFileProvider fileProvider, EncFSConfig config,
            byte[] passwordKey)

The first two constructors are easy to use ones for volumes on the local
filesystem. The next two allow non-local storage to be plugged in using
a custom EncFSFileProvider implementation. The last two allow the config
file to be parsed externally, to support the use case where the config
file is located separately than the volume.
2012-02-01 18:59:49 -08:00
Mark Pariente f1f22e113a Rename file provider classes
EncFSNativeFileSource -> EncFSFileProvider
EncFSLocalFileSystemNativeFileSource -> EncFSLocalFileProvider
2012-02-01 18:13:53 -08:00
aefo e26ae1462e Change throwing of caught exceptions to include the original / inner
one (to make it easier to trace issues / debug the original cause)
2012-01-31 20:03:24 +00:00
Mark Pariente 1097cdc980 Add test for the String constructor of EncFSVolume 2012-01-22 13:02:16 -08:00
Mark Pariente a62084b57c Fix EncFSVolume.listFiles() for the root dir
EncFSVolume.listFiles() would fail when given this.rootDir as a
parameter because it concatanated the rootDir's last path element
with the root path and ended up causing null pointer exception in
EncFSLocalFileSystemNativeFileSource.listFiles().
2012-01-22 12:49:59 -08:00
Mark Pariente fcc46ee700 Fix EncFSFileInfo.convertToFileInfo() for root directory
In case the file parameter was the root directory, this function
attempted to substring into the parent directory using the root
directories length, resulting in out of bounds index access in
substring().
2012-01-22 12:25:31 -08:00
aefo 23e44e1489 Method renames & adding license headers 2012-01-11 21:19:10 +00:00
aefo 8259a2619d Add initial support for copying files unique file IV 2012-01-11 21:10:27 +00:00
aefo 86e4ead7fc Refactor to allow non local file system based volumes 2012-01-08 16:25:23 +00:00
aefo e7c9798c57 Multiple updates
1) Bug fix for EncFSInputStream missing off the last byte of the stream
2) Initial support for EncFSFileOutputStream
3) Additional tests
4) EncFSComparer enhanced to check file read/ re-write
2012-01-01 16:11:28 +00:00
aefo 4d1754de1b Added check that the file names can be re-encoded correctly 2011-12-30 15:27:10 +00:00
aefo 7d83d8c021 Bug fixes for directory renames & file name encoding 2011-12-29 17:22:58 +00:00
aefo 0989d3bcc9 Updates for handling directory renames with chained IV is used 2011-12-29 12:38:09 +00:00
aefo 84d1ccf7a4 Added comment 2011-12-27 11:52:19 +00:00
aefo 47f1a8a74e Added check that not renaming directory when using name chained IV 2011-12-27 11:16:59 +00:00
aefo 6979394153 Add shell opertions like mkdir(s) / mv / rm 2011-12-26 21:35:22 +00:00
aefo 4bb7895043 inital commit of being able to encode file names 2011-12-26 18:43:44 +00:00
aefo 4fed749174 Added code comments 2011-12-26 18:18:00 +00:00
aefo bdee7ef4fa Merge remote-tracking branch 'upstream/master'. Also extracted unit
tests to new files

Conflicts:
	src/main/java/org/mrpdaemon/sec/encfs/EncFSCrypto.java
	src/main/java/org/mrpdaemon/sec/encfs/EncFSFile.java
	src/test/java/org/mrpdaemon/sec/encfs/EncFSComparer.java
	src/test/java/org/mrpdaemon/sec/encfs/EncFSVolumeTest.java
2011-12-21 18:05:11 +00:00
aefo 31a551c0db Initial commit for support of encoding file names (still work in
progress)
2011-12-21 11:24:00 +00:00
Mark Pariente bf71a24594 Add more test volumes
Added test volumes created with encfs 1.7.4:

* Default settings
* No uniqueIV (no per-file IV header)
2011-12-21 00:13:12 -08:00
Mark Pariente 6986e111c7 Don't use BufferedInputStream in EncFSVolumeTest 2011-12-20 23:28:35 -08:00
aefo 8db0057abc Correct compile error 2011-12-20 23:20:11 -08:00