aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-10-04 20:24:19 +0200
committerChristian Schneppe <christian@pix-art.de>2018-10-04 20:24:19 +0200
commitd519f1df874a16394b26456f132b3083ad68b116 (patch)
treee35c72058839a4dbdc0adf9dbee808472148eb24 /src/main
parentca8f2ae6ec53e6fa451a43241d9ed7ac07b03364 (diff)
fixed regression introduce in earlier commit. don’t use conscrypt on older devices
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/pixart/messenger/services/AbstractConnectionManager.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/services/AbstractConnectionManager.java b/src/main/java/de/pixart/messenger/services/AbstractConnectionManager.java
index a65a990c8..e29d91618 100644
--- a/src/main/java/de/pixart/messenger/services/AbstractConnectionManager.java
+++ b/src/main/java/de/pixart/messenger/services/AbstractConnectionManager.java
@@ -40,14 +40,14 @@ public class AbstractConnectionManager {
public static InputStream upgrade(DownloadableFile file, InputStream is, boolean gcm) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, InvalidKeyException, NoSuchPaddingException, NoSuchProviderException {
if (file.getKey() != null && file.getIv() != null) {
if (gcm) {
- Cipher cipher = Compatibility.twentyTwo() ? Cipher.getInstance(CIPHERMODE) : Cipher.getInstance(CIPHERMODE, PROVIDER);
+ final 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.ENCRYPT_MODE, keySpec, ivSpec);
return new CipherInputStream(is, cipher);
} else {
IvParameterSpec ips = new IvParameterSpec(file.getIv());
- Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+ final Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(file.getKey(), KEYTYPE), ips);
return new CipherInputStream(is, cipher);
}
@@ -77,14 +77,14 @@ public class AbstractConnectionManager {
}
try {
if (gcm) {
- Cipher cipher = Compatibility.twentyTwo() ? Cipher.getInstance(CIPHERMODE) : Cipher.getInstance(CIPHERMODE, PROVIDER);
+ final 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");
+ final Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(file.getKey(), KEYTYPE), ips);
return new CipherOutputStream(os, cipher);
}