@@ -405,7 +405,7 @@ public class HttpDownloadConnection implements Transferable {
if (!file.exists() && !file.createNewFile()) {
throw new FileWriterException();
}
- os = AbstractConnectionManager.createOutputStream(file, true);
+ os = AbstractConnectionManager.createOutputStream(file);
}
int count;
byte[] buffer = new byte[4096];
@@ -66,14 +66,14 @@ public class AbstractConnectionManager {
}
public static OutputStream createAppendedOutputStream(DownloadableFile file) {
- return createOutputStream(file, false, true);
+ return createOutputStream(file, true);
}
- public static OutputStream createOutputStream(DownloadableFile file, boolean gcm) {
- return createOutputStream(file, gcm, false);
+ public static OutputStream createOutputStream(DownloadableFile file) {
+ return createOutputStream(file, false);
}
- private static OutputStream createOutputStream(DownloadableFile file, boolean gcm, boolean append) {
+ private static OutputStream createOutputStream(DownloadableFile file, boolean append) {
FileOutputStream os;
try {
os = new FileOutputStream(file, append);
@@ -84,20 +84,13 @@ public class AbstractConnectionManager {
return null;
}
try {
- if (gcm) {
- Cipher cipher = Compatibility.twentyTwo() ? Cipher.getInstance(CIPHERMODE) : Cipher.getInstance(CIPHERMODE, PROVIDER);
- SecretKeySpec keySpec = new SecretKeySpec(file.getKey(), KEYTYPE);
- IvParameterSpec ivSpec = new IvParameterSpec(file.getIv());
- cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
- return new CipherOutputStream(os, cipher);
- } else {
- IvParameterSpec ips = new IvParameterSpec(file.getIv());
- Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
- cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(file.getKey(), KEYTYPE), ips);
- return new CipherOutputStream(os, cipher);
- }
+ Cipher cipher = Cipher.getInstance(CIPHERMODE);
+ SecretKeySpec keySpec = new SecretKeySpec(file.getKey(), KEYTYPE);
+ IvParameterSpec ivSpec = new IvParameterSpec(file.getIv());
+ cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
+ return new CipherOutputStream(os, cipher);
} catch (Exception e) {
- throw new AssertionError(e);
+ return null;
}
}
@@ -151,18 +151,18 @@ public class JingleConnection implements Transferable {
}
};
- public InputStream getFileInputStream() {
+ InputStream getFileInputStream() {
return this.mFileInputStream;
}
- public OutputStream getFileOutputStream() throws IOException {
+ OutputStream getFileOutputStream() throws IOException {
if (this.file == null) {
Log.d(Config.LOGTAG,"file object was not assigned");
return null;
}
this.file.getParentFile().mkdirs();
this.file.createNewFile();
- this.mFileOutputStream = AbstractConnectionManager.createOutputStream(this.file,message.getEncryption() == Message.ENCRYPTION_AXOLOTL);
+ this.mFileOutputStream = AbstractConnectionManager.createOutputStream(this.file);
return this.mFileOutputStream;
}
@@ -94,8 +94,7 @@ public class JingleInbandTransport extends JingleTransport {
}
@Override
- public void receive(DownloadableFile file,
- OnFileTransmissionStatusChanged callback) {
+ public void receive(DownloadableFile file, OnFileTransmissionStatusChanged callback) {
this.onFileTransmissionStatusChanged = callback;
this.file = file;
try {
@@ -115,8 +114,7 @@ public class JingleInbandTransport extends JingleTransport {
}
@Override
- public void send(DownloadableFile file,
- OnFileTransmissionStatusChanged callback) {
+ public void send(DownloadableFile file, OnFileTransmissionStatusChanged callback) {
this.onFileTransmissionStatusChanged = callback;
this.file = file;
try {