diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-10-22 13:06:46 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-10-22 13:06:46 +0200 |
commit | 62b0fc3fdac1af440d61bb6d197dcd7fc34372b4 (patch) | |
tree | 9bda78ccbc7e7c10f2f643f9bf67eadf33c23443 /src/eu/siacs/conversations/utils/CryptoHelper.java | |
parent | 45bdadd915ed0e0135de16876f9842b3401f1ac4 (diff) |
made httpconnection accept aes encrypted files
Diffstat (limited to '')
-rw-r--r-- | src/eu/siacs/conversations/utils/CryptoHelper.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/eu/siacs/conversations/utils/CryptoHelper.java b/src/eu/siacs/conversations/utils/CryptoHelper.java index a28b519e..47595c6e 100644 --- a/src/eu/siacs/conversations/utils/CryptoHelper.java +++ b/src/eu/siacs/conversations/utils/CryptoHelper.java @@ -5,7 +5,6 @@ import java.nio.charset.Charset; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; -import java.util.Arrays; import eu.siacs.conversations.entities.Account; import android.util.Base64; @@ -28,9 +27,11 @@ public class CryptoHelper { } public static byte[] hexToBytes(String hexString) { - byte[] array = new BigInteger(hexString, 16).toByteArray(); - if (array[0] == 0) { - array = Arrays.copyOfRange(array, 1, array.length); + int len = hexString.length(); + byte[] array = new byte[len / 2]; + for (int i = 0; i < len; i += 2) { + array[i / 2] = (byte) ((Character.digit(hexString.charAt(i), 16) << 4) + Character + .digit(hexString.charAt(i + 1), 16)); } return array; } |