2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-29 21:27:40 +00:00

Use StringBuilder

This commit is contained in:
Nicolas Fella 2018-09-29 20:43:10 +02:00
parent 85169635bd
commit 476989ffdf

View File

@ -128,14 +128,14 @@ public class RsaHelper {
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1PADDING");
cipher.init(Cipher.DECRYPT_MODE, privateKey);
String decryptedJson = "";
StringBuilder decryptedJson = new StringBuilder();
for (int i = 0; i < chunks.length(); i++) {
byte[] encryptedChunk = Base64.decode(chunks.getString(i), Base64.NO_WRAP);
String decryptedChunk = new String(cipher.doFinal(encryptedChunk));
decryptedJson += decryptedChunk;
decryptedJson.append(decryptedChunk);
}
NetworkPacket decrypted = NetworkPacket.unserialize(decryptedJson);
NetworkPacket decrypted = NetworkPacket.unserialize(decryptedJson.toString());
decrypted.setPayload(np.getPayload(), np.getPayloadSize());
return decrypted;
}