Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

deciphering linux encfs (standard config, 192 bit aes) in Java

Has anyone tried to decipher files encrypted using linux encfs in Java? I'm interested in deciphering the file, and just the file name (not the whole file). I tried:

SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
//SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithMD5AndAES");
KeySpec spec = new PBEKeySpec("asdasd".toCharArray(), new String("Ip/6nf5p4Cvg4uocLdIeHJ7uW/Y=").getBytes(), 162752, 192);
SecretKey tmp = factory.generateSecret(spec);
SecretKey secret = new SecretKeySpec(tmp.getEncoded(), "AES");
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, secret);

I have encfs running with the dafault settings (standard mode, 192 bit aes), and the password should be "asdasd". The config file that encfs generates is:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
  <!DOCTYPE boost_serialization>
  <boost_serialization signature="serialization::archive" version="7">
    <config class_id="0" tracking_level="1" version="20" object_id="_0">
<version>20100713</version>
<creator>EncFS 1.6</creator>
<cipherAlg class_id="1" tracking_level="0" version="0">
    <name>ssl/aes</name>
    <major>2</major>
    <minor>2</minor>
</cipherAlg>
<nameAlg>
    <name>nameio/block</name>
    <major>3</major>
    <minor>0</minor>
</nameAlg>
<keySize>192</keySize>
<blockSize>1024</blockSize>
<uniqueIV>1</uniqueIV>
<chainedNameIV>1</chainedNameIV>
<externalIVChaining>0</externalIVChaining>
<blockMACBytes>0</blockMACBytes>
<blockMACRandBytes>0</blockMACRandBytes>
<allowHoles>1</allowHoles>
<encodedKeySize>44</encodedKeySize>
<encodedKeyData>
    SFGMGDJNNROM/b+sMMlM24DxUsKW80Sen/IFaP849qqqPjy1jP1iiWB8eGB=
</encodedKeyData>
<saltLen>20</saltLen>
<saltData>
    qjGF2+ngKRPJ2zkx8dMw/Rv0nxg=
</saltData>
<kdfIterations>156293</kdfIterations>
<desiredKDFDuration>500</desiredKDFDuration>
    </config>
    </boost_serialization>

Has anyone tried this before and has the code to show for it?

like image 527
user852502 Avatar asked Jul 19 '11 17:07

user852502


People also ask

What is AES in Java?

AES, Advanced Encryption Standard is a block ciphertext encryption and decryption algorithm that processes a block of 128 bits of data using secret keys of 128, 192, or 256 bits. We will also discuss how this algorithm can be implemented using the Java programming language.

Does Java support AES 256?

Here padding is required and Java provides 3 alternatives. For encoding, the AES algorithm is repetitive in nature and supports 128, 192, and 256 bits.

Which algorithm is best for encryption and decryption in Java?

AES is an Advanced Encryption Standard algorithm. It is a type of symmetric, block cipher encryption and decryption algorithm. It works with key size 128, 192, and 256 bits. It uses a valid and similar secret key for both encryption and decryption.


1 Answers

This project seems to do exactly what you're talking about. It seems easy enough to use the API:

EncFSVolume encFSVolume = new EncFSVolume("<path>", "password");

Hope this helps!

like image 93
Daniel Woods Avatar answered Sep 28 '22 12:09

Daniel Woods