Commit Graph

152 Commits (master)

Author SHA1 Message Date
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
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 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 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 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
aefo 893a0f0291 Added toString for the config 2011-12-20 23:20:11 -08:00
aefo 233def6365 Fixes for skipping files in the raw FS that aren't encoded with our volume key 2011-12-20 23:20:11 -08:00
aefo 4ff26d0a85 Added getContentsLength method 2011-12-18 18:29:02 +00:00
aefo e9a62c9a48 Added support for "ls -ltr" to allow sorting & seeing more details in
the listing (so that you can see sizes / modified times)
2011-12-18 18:28:03 +00:00
aefo 38f77472b8 Added toString for the config 2011-12-17 20:51:47 +00:00
aefo 7a75883ade Fixes for skipping files in the raw FS that aren't encoded with our volume key 2011-12-17 20:47:57 +00:00
aefo bfb766d1c8 Fix to support read(byte[] output, int offset, int size) method 2011-12-17 20:46:06 +00:00
Mark Pariente 1fb202421f Implemented nameio/stream file name encryption algorithm
This change adds support for nameio/stream mode of filename encryption.
Also as a bonus change it fixes the MAC computation for volumes that
do not use chained name IV.
2011-12-16 01:41:40 -08:00
Mark Pariente 10e86483c6 Add support for uniqueIV = 0
This change adds support for EncFS volume created with a configuration
that doesn't use unique file IV headers.
2011-12-16 00:34:40 -08:00
Mark Pariente 6650a0be3c Support variable size volume keys
Remove hardcoded 32-byte volume key size in EncFSCrypto.decryptVolumeKey
to support volumes with key sizes different than 256 bits. Tested to
work fine with the standard options under encfs 1.7.4 which creates
a volume with a 192-bit key.
2011-12-16 00:29:20 -08:00
Mark Pariente e1bd0bc68d Add EncFSVolume.getConfigFileName()
Added a method to expose the config file name for library users.
2011-12-02 00:02:20 -08:00
Mark Pariente 77031f057a Enable PBKDF2 result caching
Added constructors for EncFSVolume to allow the password-based key
and IV data to be cached, and re-used to create an EncFSVolume for
the same volume at a later time.
2011-11-29 22:37:33 -08:00
Mark Pariente 41ecff532e Un-implement EncFSFileInputStream.read()
On some runtimes the readBlock() implementation ended up recursively
calling into read(byte[]) since the call into super.read(byte[]) gets
reflected back into EncFSFileInputStream resulting into infinite
recursion. As a lame solution, removing read(byte[], int, int) from
EncFSFileInputStream and calling FileInputStream.read(byte[], int, int)
from readBlock().
2011-11-22 22:56:47 -08:00
Mark Pariente 334c6073d7 Remove unused import
Forgot to remove import for javax.xml.bind.DatatypeConverter
from EncFSCrypto.java in the last commit.
2011-11-21 22:32:59 -08:00
Mark Pariente f28612b7a1 Get rid of javax.xml.bind.DatatypeConverter
Bundle Robert Harder's Base64 implementation [1] instead of using
javax.xml.bind.DatatypeConverter to do base64 decoding since
Android doesn't package JAXB.

[1] http://iharder.sourceforge.net/current/index.html
2011-11-19 19:56:02 -08:00
Mark Pariente 2d5b0837d2 Bugfix: use equals() to compare strings 2011-11-19 19:53:09 -08:00
Mark Pariente 91df44286b Initial commit of encfs-java 2011-11-11 00:09:46 -08:00