diff options
author | lado <herrlado@gmail.com> | 2012-01-21 00:37:33 +0100 |
---|---|---|
committer | lado <herrlado@gmail.com> | 2012-01-21 00:37:33 +0100 |
commit | dd9f6a36a37fc34b1fa2fc8e01dcc23d9e9a1c28 (patch) | |
tree | 395d8e17bda0fbc7d0102ec15a90700e351f294e /vdrmanager/src/de/bjusystems | |
parent | ffa942ddb37fffbcab186c0782bda566ef674f71 (diff) | |
download | vdr-manager-dd9f6a36a37fc34b1fa2fc8e01dcc23d9e9a1c28.tar.gz vdr-manager-dd9f6a36a37fc34b1fa2fc8e01dcc23d9e9a1c28.tar.bz2 |
no jnior des. Try ssl. version changed to 404
Diffstat (limited to 'vdrmanager/src/de/bjusystems')
-rw-r--r-- | vdrmanager/src/de/bjusystems/vdrmanager/utils/crypt/NativeDES.java | 21 | ||||
-rw-r--r-- | vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java | 42 |
2 files changed, 27 insertions, 36 deletions
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/utils/crypt/NativeDES.java b/vdrmanager/src/de/bjusystems/vdrmanager/utils/crypt/NativeDES.java deleted file mode 100644 index 114f540..0000000 --- a/vdrmanager/src/de/bjusystems/vdrmanager/utils/crypt/NativeDES.java +++ /dev/null @@ -1,21 +0,0 @@ -package de.bjusystems.vdrmanager.utils.crypt; - -public class NativeDES { - static { - System.loadLibrary("native_des"); - } - /** - * @param str - * @param key - * @return - */ - public native String encrypt( String str, String key); - - - /** - * @param str - * @param key - * @return - */ - public native String decrypt(String str, String key); -} diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java index 1b97237..f24ac4c 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java @@ -13,10 +13,12 @@ import java.util.List; import java.util.Timer; import java.util.TimerTask; +import javax.net.ssl.SSLSocket; +import javax.net.ssl.SSLSocketFactory; + import android.util.Log; import de.bjusystems.vdrmanager.app.C; import de.bjusystems.vdrmanager.data.Preferences; -import de.bjusystems.vdrmanager.utils.crypt.NativeDES; /** * Class for SVDRP communication @@ -50,8 +52,8 @@ public abstract class SvdrpClient<Result> { // } private Timer watchDog = new Timer(); - - private NativeDES crypt = new NativeDES(); + + //private NativeDES crypt = new NativeDES(); public boolean isConnected() { if (socket == null) { @@ -154,7 +156,17 @@ public abstract class SvdrpClient<Result> { try { // connect informListener(SvdrpEvent.CONNECTING, null); - socket = new Socket(); + + if (Preferences.get().isSecure() || true) { + + SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory + .getDefault(); // Erzeugt eine SSLSocketFactory mit + // Standartkonfiguration + socket = (SSLSocket) factory.createSocket(); + } else { + socket = new Socket(); + } + socket.connect( new InetSocketAddress(prefs.getSvdrpHost(), prefs .getSvdrpPort()), @@ -202,8 +214,8 @@ public abstract class SvdrpClient<Result> { // create streams outputStream = socket.getOutputStream(); inputStream = socket.getInputStream(); - //TODO http://projects.vdr-developer.org/issues/790 - //inputStream = new InflaterInputStream(socket.getInputStream()) + // TODO http://projects.vdr-developer.org/issues/790 + // inputStream = new InflaterInputStream(socket.getInputStream()) // password needed? informListener(SvdrpEvent.LOGIN, null); @@ -244,9 +256,9 @@ public abstract class SvdrpClient<Result> { protected void writeLine(final String line) throws IOException { String command = line + "\r\n"; - if(false && Preferences.get().isSecure()){ - command = crypt.encrypt(command, Preferences.get().getPassword()); - } + //if (false && Preferences.get().isSecure()) { + //command = crypt.encrypt(command, Preferences.get().getPassword()); + //} final byte[] bytes = command.getBytes("utf-8"); outputStream.write(bytes); outputStream.flush(); @@ -286,17 +298,17 @@ public abstract class SvdrpClient<Result> { // remember char lineBytes.write(c); } - + String line = null; - try{ + try { line = lineBytes.toString(Preferences.get().getEncoding()); - } catch(UnsupportedEncodingException usex){ + } catch (UnsupportedEncodingException usex) { Log.w(TAG, usex); line = lineBytes.toString(); } - if(false && Preferences.get().isSecure()){ - line = crypt.decrypt(line, Preferences.get().getPassword()); - } + //if (false && Preferences.get().isSecure()) { + //line = crypt.decrypt(line, Preferences.get().getPassword()); + //} return line; } |