From dd9f6a36a37fc34b1fa2fc8e01dcc23d9e9a1c28 Mon Sep 17 00:00:00 2001 From: lado Date: Sat, 21 Jan 2012 00:37:33 +0100 Subject: no jnior des. Try ssl. version changed to 404 --- vdrmanager/AndroidManifest.xml | 2 +- vdrmanager/jni/Android.mk | 8 ---- ...e_bjusystems_vdrmanager_utils_crypt_NativeDES.c | 24 ------------ ...e_bjusystems_vdrmanager_utils_crypt_NativeDES.h | 29 -------------- vdrmanager/libs/armeabi/libnative_des.so | Bin 1584 -> 0 bytes .../vdrmanager/utils/crypt/NativeDES.java | 21 ----------- .../vdrmanager/utils/svdrp/SvdrpClient.java | 42 +++++++++++++-------- 7 files changed, 28 insertions(+), 98 deletions(-) delete mode 100644 vdrmanager/jni/Android.mk delete mode 100644 vdrmanager/jni/de_bjusystems_vdrmanager_utils_crypt_NativeDES.c delete mode 100644 vdrmanager/jni/de_bjusystems_vdrmanager_utils_crypt_NativeDES.h delete mode 100755 vdrmanager/libs/armeabi/libnative_des.so delete mode 100644 vdrmanager/src/de/bjusystems/vdrmanager/utils/crypt/NativeDES.java diff --git a/vdrmanager/AndroidManifest.xml b/vdrmanager/AndroidManifest.xml index 1b80d25..bdaeece 100644 --- a/vdrmanager/AndroidManifest.xml +++ b/vdrmanager/AndroidManifest.xml @@ -1,7 +1,7 @@ + android:versionCode="400"> diff --git a/vdrmanager/jni/Android.mk b/vdrmanager/jni/Android.mk deleted file mode 100644 index a5427ce..0000000 --- a/vdrmanager/jni/Android.mk +++ /dev/null @@ -1,8 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE := native_des -LOCAL_SRC_FILES := de_bjusystems_vdrmanager_utils_crypt_NativeDES.c - -include $(BUILD_SHARED_LIBRARY) diff --git a/vdrmanager/jni/de_bjusystems_vdrmanager_utils_crypt_NativeDES.c b/vdrmanager/jni/de_bjusystems_vdrmanager_utils_crypt_NativeDES.c deleted file mode 100644 index 569b694..0000000 --- a/vdrmanager/jni/de_bjusystems_vdrmanager_utils_crypt_NativeDES.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "de_bjusystems_vdrmanager_utils_crypt_NativeDES.h" - - /* - * Class: de_bjusystems_vdrmanager_utils_crypt_NativeDES - * Method: encrypt - * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; - */ - JNIEXPORT jstring JNICALL Java_de_bjusystems_vdrmanager_utils_crypt_NativeDES_encrypt( - JNIEnv *env, jobject c, jstring jstr, jstring jkey) { - - return jstr; - } - - /* - * Class: de_bjusystems_vdrmanager_utils_crypt_NativeDES - * Method: decrypt - * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; - */ - JNIEXPORT jstring JNICALL Java_de_bjusystems_vdrmanager_utils_crypt_NativeDES_decrypt( - JNIEnv *env, jobject c, jstring jstr, jstring key) { - - return jstr; - } - diff --git a/vdrmanager/jni/de_bjusystems_vdrmanager_utils_crypt_NativeDES.h b/vdrmanager/jni/de_bjusystems_vdrmanager_utils_crypt_NativeDES.h deleted file mode 100644 index b54241c..0000000 --- a/vdrmanager/jni/de_bjusystems_vdrmanager_utils_crypt_NativeDES.h +++ /dev/null @@ -1,29 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class de_bjusystems_vdrmanager_utils_crypt_NativeDES */ - -#ifndef _Included_de_bjusystems_vdrmanager_utils_crypt_NativeDES -#define _Included_de_bjusystems_vdrmanager_utils_crypt_NativeDES -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: de_bjusystems_vdrmanager_utils_crypt_NativeDES - * Method: encrypt - * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_de_bjusystems_vdrmanager_utils_crypt_NativeDES_encrypt - (JNIEnv *, jobject, jstring, jstring); - -/* - * Class: de_bjusystems_vdrmanager_utils_crypt_NativeDES - * Method: decrypt - * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_de_bjusystems_vdrmanager_utils_crypt_NativeDES_decrypt - (JNIEnv *, jobject, jstring, jstring); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/vdrmanager/libs/armeabi/libnative_des.so b/vdrmanager/libs/armeabi/libnative_des.so deleted file mode 100755 index a4d3aba..0000000 Binary files a/vdrmanager/libs/armeabi/libnative_des.so and /dev/null differ 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 { // } 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 { 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 { // 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 { 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 { // 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; } -- cgit v1.2.3