2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-31 14:15:14 +00:00

Explicit exceptions in NetworkPackage's encrypt/decrypt

This commit is contained in:
Albert Vaca
2015-01-21 22:31:53 -08:00
parent ba64b42711
commit e4f9c15b36

View File

@@ -28,6 +28,7 @@ import android.util.Base64;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.kde.kdeconnect.Helpers.DeviceHelper;
import org.kde.kdeconnect.UserInterface.MainSettingsActivity;
@@ -35,6 +36,7 @@ import org.kde.kdeconnect.UserInterface.MainSettingsActivity;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.security.GeneralSecurityException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.util.ArrayList;
@@ -187,7 +189,7 @@ public class NetworkPackage {
return np;
}
public NetworkPackage encrypt(PublicKey publicKey) throws Exception {
public NetworkPackage encrypt(PublicKey publicKey) throws GeneralSecurityException {
String serialized = serialize();
@@ -217,7 +219,7 @@ public class NetworkPackage {
}
public NetworkPackage decrypt(PrivateKey privateKey) throws Exception {
public NetworkPackage decrypt(PrivateKey privateKey) throws GeneralSecurityException, JSONException {
JSONArray chunks = mBody.getJSONArray("data");