summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2014-07-07 20:51:08 +0200
committerArne Schwabe <arne@rfc2549.org>2014-07-07 20:51:08 +0200
commitfba9704078ff9ef321131669e9677eb400eb05fb (patch)
treee7a17a97d4147ea2483c0bd4359a61b6d96488c9
parent02d5a389fe85599b6e41fa9d0208bee161e9955f (diff)
Add annotation that ECB mode is fine in this particular case
-rw-r--r--main/src/main/java/de/blinkt/openvpn/VpnProfile.java12
-rw-r--r--main/src/main/res/layout/basic_settings.xml2
2 files changed, 9 insertions, 5 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java
index 35bfc551..7e25e79a 100644
--- a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java
+++ b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java
@@ -1,5 +1,6 @@
package de.blinkt.openvpn;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -890,12 +891,15 @@ public class VpnProfile implements Serializable {
try {
+ /* ECB is perfectly fine in this special case, since we are using it for
+ the public/private part in the TLS exchange
+ */
+ @SuppressLint(GetInstance)
+ Cipher rsaSigner = Cipher.getInstance("RSA/ECB/PKCS1PADDING");
- Cipher rsasinger = Cipher.getInstance("RSA/ECB/PKCS1PADDING");
+ rsaSigner.init(Cipher.ENCRYPT_MODE, privkey);
- rsasinger.init(Cipher.ENCRYPT_MODE, privkey);
-
- byte[] signed_bytes = rsasinger.doFinal(data);
+ byte[] signed_bytes = rsaSigner.doFinal(data);
return Base64.encodeToString(signed_bytes, Base64.NO_WRAP);
} catch (NoSuchAlgorithmException e) {
diff --git a/main/src/main/res/layout/basic_settings.xml b/main/src/main/res/layout/basic_settings.xml
index c6192dc2..86e0640e 100644
--- a/main/src/main/res/layout/basic_settings.xml
+++ b/main/src/main/res/layout/basic_settings.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:b linkt="http://schemas.android.com/apk/res-auto"
+ xmlns:blinkt="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >