aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/services
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-06-25 11:05:25 +0200
committerChristian Schneppe <christian@pix-art.de>2019-06-25 11:05:25 +0200
commit6891ca336b64dc00a9f4a964c28b85c492401cb8 (patch)
treef061ba386091b3640f37d90158ffa254a7c50ae7 /src/main/java/de/pixart/messenger/services
parenta8f97149d9516298f6756789f66907974b564945 (diff)
fix jingle file transfer
fixes #360
Diffstat (limited to 'src/main/java/de/pixart/messenger/services')
-rw-r--r--src/main/java/de/pixart/messenger/services/AbstractConnectionManager.java13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/main/java/de/pixart/messenger/services/AbstractConnectionManager.java b/src/main/java/de/pixart/messenger/services/AbstractConnectionManager.java
index 4b2239895..3399b7861 100644
--- a/src/main/java/de/pixart/messenger/services/AbstractConnectionManager.java
+++ b/src/main/java/de/pixart/messenger/services/AbstractConnectionManager.java
@@ -39,21 +39,14 @@ public class AbstractConnectionManager {
this.mXmppConnectionService = service;
}
- public static InputStream upgrade(DownloadableFile file, InputStream is, boolean gcm) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, InvalidKeyException, NoSuchPaddingException, NoSuchProviderException {
+ public static InputStream upgrade(DownloadableFile file, InputStream is) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, InvalidKeyException, NoSuchPaddingException, NoSuchProviderException {
if (file.getKey() != null && file.getIv() != null) {
- if (gcm) {
final Cipher cipher = Compatibility.twentyEight() ? Cipher.getInstance(CIPHERMODE) : Cipher.getInstance(CIPHERMODE, PROVIDER);
SecretKeySpec keySpec = new SecretKeySpec(file.getKey(), KEYTYPE);
IvParameterSpec ivSpec = new IvParameterSpec(file.getIv());
cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec);
return new CipherInputStream(is, cipher);
} else {
- IvParameterSpec ips = new IvParameterSpec(file.getIv());
- final Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
- cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(file.getKey(), KEYTYPE), ips);
- return new CipherInputStream(is, cipher);
- }
- } else {
return is;
}
}
@@ -63,6 +56,10 @@ public class AbstractConnectionManager {
return createOutputStream(file, false, true);
}
+ public static OutputStream createOutputStream(DownloadableFile file) {
+ return createOutputStream(file, false);
+ }
+
public static OutputStream createOutputStream(DownloadableFile file, boolean gcm) {
return createOutputStream(file, gcm, false);
}