aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/utils
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-04-13 20:56:11 +0200
committerChristian Schneppe <christian@pix-art.de>2017-04-13 20:56:11 +0200
commit09d7b611af577fb920f032521cc8f1603cb5ec40 (patch)
treefe4216fd695c78532ce52ea71863dfc9d14ac1e7 /src/main/java/de/pixart/messenger/utils
parent0944064e2cf831f2be1d57d4d44505294f1bf21b (diff)
use aesgcm:// uri scheme for omemo encrypted http upload
Diffstat (limited to 'src/main/java/de/pixart/messenger/utils')
-rw-r--r--src/main/java/de/pixart/messenger/utils/CryptoHelper.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/utils/CryptoHelper.java b/src/main/java/de/pixart/messenger/utils/CryptoHelper.java
index da9007a06..b5d3d6c61 100644
--- a/src/main/java/de/pixart/messenger/utils/CryptoHelper.java
+++ b/src/main/java/de/pixart/messenger/utils/CryptoHelper.java
@@ -8,6 +8,8 @@ import org.bouncycastle.asn1.x500.style.BCStyle;
import org.bouncycastle.asn1.x500.style.IETFUtils;
import org.bouncycastle.cert.jcajce.JcaX509CertificateHolder;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateEncodingException;
@@ -230,4 +232,15 @@ public final class CryptoHelper {
return R.string.encryption_choice_pgp;
}
}
+
+ public static URL toAesGcmUrl(URL url) {
+ if (!url.getProtocol().equalsIgnoreCase("https")) {
+ return url;
+ }
+ try {
+ return new URL("aesgcm" + url.toString().substring(url.getProtocol().length()));
+ } catch (MalformedURLException e) {
+ return url;
+ }
+ }
}