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

nameAlg nameio/null #47

Closed jrondorf closed 11 years ago

jrondorf commented 11 years ago

Hi mrpdaemon,

BoxCryptor is also using a unencrypted filename encfs setting, see http://blog.boxcryptor.com/boxcryptor-beta-091-released

The nameAlg setting in the encfs6 XML file looks like `

nameio/null 1 0

`

Should be quite easy to implement (or maybe I am missing something...).

New constant in EncFSConfig: /** Volume configuration uses nameio/stream for filename encryption */ public static final int ENCFS_CONFIG_NAME_ALG_NULL = 4;

New if/else in EncFSConfigWriter: } else if (config.getNameAlgorithm() == EncFSConfig.ENCFS_CONFIG_NAME_ALG_NULL){ result += "\t\t<name>nameio/null</name>\n"; result += "\t\t<major>1</major>\n"; result += "\t\t<minor>0</minor>\n"; }

New if/else in EncFSConfigParser: } else if (algName.equals("nameio/null")) { config.setNameAlgorithm(EncFSConfig.ENCFS_CONFIG_NAME_ALG_NULL);

New check in EncFSCrypto (is this all what would be needed?): public static String decodeName(EncFSVolume volume, String fileName, String volumePath) throws EncFSCorruptDataException, EncFSChecksumException { if (volume.getConfig().getNameAlgorithm() == EncFSConfig.ENCFS_CONFIG_NAME_ALG_NULL){ return fileName; }

Cheers, 1jr

mrpdaemon commented 11 years ago

Hello 1jr,

Thanks for the detailed instructions :) You're pretty much spot on, only thing missing is that we need corresponding logic in EncFSCrypto.encodeName() as well to just not do anything when encoding filenames in this nameio/null mode. I'll whip up a patch with these changes - do you happen to have a test volume created with boxcryptor (with no sensitive files in it and a dummy password) that I can use to test the change?

jrondorf commented 11 years ago

Hi mrpdaemon,

Thanks for your reply. Sure, the encoding... I put a boxcryptor file with these settings here. When you finished, I will also perform some tests.

https://dl.dropbox.com/u/2102695/encfs/BoxCryptor.bc.zip

Best regards, 1jr

mrpdaemon commented 11 years ago

1jr, thanks for providing a test volume. Figuring out the password was non-trivial :P

One problem with this name algorithm is that there is no way to distinguish unencrytpted files (such as !IMPORTANT BoxCryptor Information.txt in your example volume) from encrypted files, so such files will be reported through API's such as EncFSFile.listFiles(). I'm wondering if BoxCryptor uses any special encoding tricks to distinguish (perhaps leading '!') ?

I've implemented this algorithm and pushed it as cdcd5923e83f2728453e04e3126ce4864896655d. Let me know how it works for you.