removed unused code (otr jingle encrypted file transfer)

This commit is contained in:
Daniel Gultsch 2018-09-30 13:48:11 +02:00
parent 653cb152e2
commit 1cbb60d7ed
4 changed files with 16 additions and 25 deletions

View File

@ -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];

View File

@ -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);
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);
} 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);
}
} catch (Exception e) {
throw new AssertionError(e);
return null;
}
}

View File

@ -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;
}

View File

@ -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 {