A modified version of encfs-java for MiXplorer file manager
A modified version of encfs-java for MiXplorer file manager.
The original project:
https://github.com/mrpdaemon/encfs-java
//private Cipher streamCipher;
//private Cipher blockCipher;
...
//streamCipher = StreamCrypto.newStreamCipher();
//blockCipher = BlockCrypto.newBlockCipher();
...
/*public Cipher getStreamCipher() {
return streamCipher;
}
/*public Cipher getBlockCipher() {
return blockCipher;
}*/
private static byte[] blockOperation(EncFSVolume volume, byte[] ivSeed,
byte[] data, int opMode) throws InvalidAlgorithmParameterException,
IllegalBlockSizeException, BadPaddingException,
EncFSUnsupportedException {
//Cipher cipher = volume.getBlockCipher();
Cipher cipher = BlockCrypto.newBlockCipher();
EncFSCrypto.cipherInit(volume, opMode, cipher, ivSeed);
return cipher.doFinal(data);
}
public static byte[] streamDecrypt(EncFSVolume volume, byte[] ivSeed,
byte[] data) throws EncFSUnsupportedException,
InvalidAlgorithmParameterException, IllegalBlockSizeException,
BadPaddingException {
//Cipher streamCipher = volume.getStreamCipher();
Cipher streamCipher = StreamCrypto.newStreamCipher();
return streamDecrypt(streamCipher, volume.getMAC(), volume.getKey(),
volume.getIV(), ivSeed, data);
}
import org.mrpdaemon.sec.encfs.PBKDF2Engine;
import org.mrpdaemon.sec.encfs.PBKDF2Parameters;
...
new EncFSVolumeBuilder()
.withFileProvider(encFSFileProvider)
.withPbkdf2Provider(new EncFSPBKDF2Provider() {
@Override
public byte[] doPBKDF2(String password, int saltLen, byte[] salt, int iterations, int keyLen) {
try {
return new PBKDF2Engine(new PBKDF2Parameters("HmacSHA1", "ISO-8859-1", salt, iterations))
.deriveKey(password.toCharArray(), keyLen + saltLen);
} catch (Exception e) {
MiXLog.e(e);
return null;
}
}
});