Commit graph

142 commits

Author SHA1 Message Date
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
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