有没有人试图解密使用Java中的linux encfs加密的文件?我有兴趣解密文件,只有文件名(不是整个文件)。我试过了:
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);
我有使用dafault设置运行的encfs(标准模式,192位aes),密码应为“asdasd”。 encfs生成的配置文件是:
<?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>
之前有没有人试过这个并且有代码可以显示呢?
答案 0 :(得分:3)
This project似乎完全按照你所说的去做。使用API似乎很容易:
EncFSVolume encFSVolume = new EncFSVolume("<path>", "password");
希望这有帮助!