2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-30 21:55:10 +00:00

Removed unused privateKey field from BaseLink

This commit is contained in:
Albert Vaca Cintora
2023-05-26 19:56:59 +02:00
parent 62cf2d6b44
commit 38edbd260a
2 changed files with 0 additions and 19 deletions

View File

@@ -15,7 +15,6 @@ import org.kde.kdeconnect.Device;
import org.kde.kdeconnect.NetworkPacket;
import java.io.IOException;
import java.security.PrivateKey;
import java.util.ArrayList;
@@ -29,7 +28,6 @@ public abstract class BaseLink {
private final BaseLinkProvider linkProvider;
private final String deviceId;
private final ArrayList<PacketReceiver> receivers = new ArrayList<>();
protected PrivateKey privateKey;
protected BaseLink(@NonNull Context context, @NonNull String deviceId, @NonNull BaseLinkProvider linkProvider) {
this.context = context;
@@ -45,10 +43,6 @@ public abstract class BaseLink {
return deviceId;
}
public void setPrivateKey(@NonNull PrivateKey key) {
privateKey = key;
}
public BaseLinkProvider getLinkProvider() {
return linkProvider;
}

View File

@@ -14,7 +14,6 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.preference.PreferenceManager;
import android.util.Base64;
import android.util.Log;
@@ -39,10 +38,7 @@ import org.kde.kdeconnect.UserInterface.MainActivity;
import org.kde.kdeconnect_tp.R;
import java.io.IOException;
import java.security.KeyFactory;
import java.security.PrivateKey;
import java.security.cert.Certificate;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -462,15 +458,6 @@ public class Device implements BaseLink.PacketReceiver {
}
}
try {
SharedPreferences globalSettings = PreferenceManager.getDefaultSharedPreferences(context);
byte[] privateKeyBytes = Base64.decode(globalSettings.getString("privateKey", ""), 0);
PrivateKey privateKey = KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(privateKeyBytes));
link.setPrivateKey(privateKey);
} catch (Exception e) {
Log.e("KDE/Device", "Exception reading our own private key", e); //Should not happen
}
Log.i("KDE/Device", "addLink " + link.getLinkProvider().getName() + " -> " + getName() + " active links: " + links.size());
if (!pairingHandlers.containsKey(link.getName())) {