Commit graph

142 commits

Author SHA1 Message Date
Mark Pariente
9077078751 Add copy/move support using externalIvChaining 2012-10-14 17:17:35 -07:00
Mark Pariente
7ca1633809 Add support for externalIvChaining in EncFS{Input|Output}Stream
This commit implements support for externalIvChaining in
EncFSInputStream and EncFSOutputStream which causes a file's volume path
to change the initialization vector (IV) which is used for encrypting
and decrypting the file contents.
2012-10-14 16:59:32 -07:00
Mark Pariente
e007337167 Remove stale comment in EncFSConfigWriter 2012-10-08 23:36:06 -07:00
Mark Pariente
b18c762bcb Recursively delete directories in EncFSLocalFileProvider
EncFSLocalFileProvider.delete() was only deleting a directory if it was
completely empty. It is more functional to just recursively delete
everything under a directory if its not empty.
2012-09-16 19:41:23 -07:00
Mark Pariente
6181b6ebdb Forgot to remove debugging logs 2012-08-26 03:22:54 -07:00
Mark Pariente
dd91907833 Implement versioning support 2012-08-26 03:13:25 -07:00
Mark Pariente
ffeb63e733 Fix return types for input/output stream functions 2012-08-26 00:32:44 -07:00
Mark Pariente
08dfe3d7ad Fix return types for EncFSFile.open{Input|Output}Stream
These methods were returning InputStream/OutputStream instead of the
more specific EncFSInputStream and EncFSOutputStream.
2012-08-26 00:08:54 -07:00
Mark Pariente
dbda446205 Fix warning and add attribution in EncFSBase64 2012-08-23 00:06:23 -07:00
Mark Pariente
b8a8f3dc6f Use Filter{Input|Output}Stream in stream classes
* EncFSFileInputStream now extends FilterInputStream
* EncFSFileOutputStream now extends FilterOutputStream
* EncFSInputStream now extends FilterInputStream

EncFSOutputStream was already using FilterOutputStream.
2012-08-22 23:53:19 -07:00
Mark Pariente
c645cc1897 Create EncFSException and subclass exceptions to it 2012-08-22 23:23:02 -07:00
Mark Pariente
808eb37c91 Fail to create volume if externalIVChaining=1 2012-08-22 23:13:27 -07:00
Mark Pariente
83cf5d0d2d Fix CRLF usage
Unfortunate to have to do this, but with the new version of git diff
explicitly showing CRLF as ^M this was starting to get annoying. We
shall use Unix newline style in encfs-java going forward.
2012-08-22 23:08:00 -07:00
Mark Pariente
cdcd5923e8 Implement unencrypted filename support (nameio/null)
BoxCryptor uses an unencrypted name algorithm to encrypt file contents
without encrypting filenames. This change implements this algorithm
and adds a unit test. Thanks 1jr for requesting this and providing
test cases.

Also added a volume integration test for this algorithm.
2012-08-14 00:46:32 -07:00
Mark Pariente
dc7d4836f3 Don't treat uniqueIV differently in EncFSFile.copy
uniqueIV just generates a bunch of random bytes in the file header so
we can use fileProvider.copy() which is more efficient for most file
providers rather than doing a full stream read/write copy.
2012-08-03 02:01:10 -07:00
Mark Pariente
3214ebc711 Eclipse formatting (whitespace fixes) 2012-06-25 22:28:17 -07:00
Zdenek Farana
4e84fe6ad8 Polymorphic isEncFSVolume methods for File and EncFSFileProvider 2012-06-25 23:52:39 +02:00
Zdenek Farana
ce6b9c4417 Simple method for checking if the provided path contains EncFS volume by detecting EncFS config file 2012-06-25 23:34:06 +02:00
Mark Pariente
03c1814aa9 Handle partial reads in EncFSInputStream.readBlock()
With network based file providers it is possible for the input stream's
read() function to return before reading a full block. The current code
treated such partial reads incorrectly by using stream decoding to
decode them. Fix is to keep reading until we either read a full block
or we hit the end of the input stream.
2012-06-01 01:23:53 -07:00
Mark Pariente
7a370eb704 Make EncFSFileOutputStream take a length parameter
Unfortunately some network storage systems such as Dropbox require
length of the file before opening an upload request so we need to
plumb file length all throughout the OutputStream creation. It is
optional for EncFSLocalFileProvider, but it is good practice to
supply this parameter whenever possible.
2012-05-24 20:21:31 -07:00
Mark Pariente
412d62e2e9 Remove stale code from EncFSLocalFileProvider
This code was causing double leading slashes in front of directories
and did not have any noticable benefits, tests pass without it.
2012-05-21 02:12:02 -07:00
Mark Pariente
80ffa6a78e Add EncFSProgressListener to monitor operation progress
copyPath() movePath() and deletePath() now take an optional
EncFSProgressListener in order to post progress events. This is useful
for displaying progress of long running operations.
2012-05-19 04:11:38 -07:00
Mark Pariente
18cdf3b477 Fix stream name decoding with chained name IV
Stream name decoding with chained name IV was broken because chained
name IV computation was unconditionally padding each path element
whereas that should only be done for block name I/O algorithm. Fix
uses each path element as is for chained IV computation with stream
name algorithm.

Also added an integration test case containing a volume created with
encfs 1.7.4 that uses stream name algorithm and chained name IV
with a directory and a test file in that directory to exercise the
path that fails without this commit.
2012-04-29 01:49:34 -07:00
Mark Pariente
afea85bf68 Implement EncFSFileProvider.getRootPath() 2012-04-28 01:49:21 -07:00
Mark Pariente
c50de9fdd3 Implement separator interface for EncFSFileProvider 2012-04-28 01:39:33 -07:00
Mark Pariente
59b860cf92 Rename EncFSVolume constants to shorter versions 2012-04-27 23:31:21 -07:00
Mark Pariente
9a6cfa4ec4 Use combinePath() and ENCFS_VOLUME_PATH_SEPARATOR 2012-04-27 23:24:24 -07:00
Mark Pariente
e21c9b8538 Add EncFSFile.combinePath() methods to combine paths 2012-04-27 22:41:51 -07:00
Mark Pariente
8c56794273 copyPath() and movePath() prevents overwriting existing files 2012-04-26 00:20:51 -07:00
Mark Pariente
f9308bff4b EncFSVolume.copyOrMovePath() fails for srcPath == dstPath 2012-04-25 23:47:15 -07:00
Mark Pariente
f9a97aafe5 EncFSVolume.movePath() allows moving into existing dirs
Previous implementation didn't work if dstPath was an existing
directory, fix the implementation to move srcPath under dstPath
if dstPath exists and is a directory.
2012-04-25 23:42:09 -07:00
Mark Pariente
9d38e6188f EncFSVolume.copyOrMovePath() fix for dir copies
When copying a directory recursively we should manually
perform the recursion since EncFSFileProvider.copy()
interface doesn't allow recursive copies.

Also, we should update dstPath with the newly created
directory to copy/move stuff from srcPath into it.
2012-04-25 23:41:58 -07:00
Mark Pariente
dba45202f8 Don't produce // as parentPath in EncFSLocalFileProvider 2012-03-07 23:31:32 -08:00
Mark Pariente
ff3a20305f Turn on allowHoles in the default EncFSConfig 2012-03-07 01:15:11 -08:00
Mark Pariente
f12f98a2a1 Make EncFSVolume.recursiveDelete private 2012-03-07 00:47:17 -08:00
Mark Pariente
00636eaaa1 EncFSVolume.deletePath() can remove non-empty dirs
Implemented recursive directory deletion support controlled by a
boolean option in EncFSVolume.deletePath(). Extended the EncFSShell
'rm' command to make use of this functionality and added a test
case to EncFSVolumeTest to exercise recursive deletion of a
non-empty directory path.
2012-03-07 00:42:27 -08:00
Mark Pariente
d38dd6015d Improve recursive copy support
Make EncFSVolume.copyPath() more robust by making it able to
recursively copy directories even with the ChainedNameIV config
option.
2012-03-04 01:59:52 -08:00
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
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
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
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