aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/utils
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2014-03-07 14:24:33 +0100
committerDaniel Gultsch <daniel@gultsch.de>2014-03-07 14:24:33 +0100
commit3bb5fcb3ca3586f2c641e0810ba0e019604ad7e4 (patch)
tree343b247e9a746cca31ed9c358bca2adf6fda309d /src/eu/siacs/conversations/utils
parent1cf05fccdb0823a99e0ea33cc51150c7e31f2f1e (diff)
tls exceptions for untrusted certs
Diffstat (limited to 'src/eu/siacs/conversations/utils')
-rw-r--r--src/eu/siacs/conversations/utils/CryptoHelper.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/utils/CryptoHelper.java b/src/eu/siacs/conversations/utils/CryptoHelper.java
new file mode 100644
index 00000000..6e606fa1
--- /dev/null
+++ b/src/eu/siacs/conversations/utils/CryptoHelper.java
@@ -0,0 +1,14 @@
+package eu.siacs.conversations.utils;
+
+public class CryptoHelper {
+ final protected static char[] hexArray = "0123456789ABCDEF".toCharArray();
+ public static String bytesToHex(byte[] bytes) {
+ char[] hexChars = new char[bytes.length * 2];
+ for ( int j = 0; j < bytes.length; j++ ) {
+ int v = bytes[j] & 0xFF;
+ hexChars[j * 2] = hexArray[v >>> 4];
+ hexChars[j * 2 + 1] = hexArray[v & 0x0F];
+ }
+ return new String(hexChars);
+ }
+}