Returning null if either the decryption or the decompression step fails
This commit is contained in:
parent
b543a1c36d
commit
b5d83717a1
1 changed files with 2 additions and 0 deletions
|
@ -134,6 +134,7 @@ public abstract class FileBin {
|
||||||
MessageDigest md1 = MessageDigest.getInstance("SHA-512");
|
MessageDigest md1 = MessageDigest.getInstance("SHA-512");
|
||||||
finalKey = md1.digest(finalKey);
|
finalKey = md1.digest(finalKey);
|
||||||
byte[] rawData = Util.decryptAES(rawDataEncripted, Util.byteToString(finalKey).getBytes());
|
byte[] rawData = Util.decryptAES(rawDataEncripted, Util.byteToString(finalKey).getBytes());
|
||||||
|
if(rawData == null) return null;
|
||||||
|
|
||||||
byte[] checksum = new byte[4];
|
byte[] checksum = new byte[4];
|
||||||
System.arraycopy(rawData, 0, checksum, 0, 4);
|
System.arraycopy(rawData, 0, checksum, 0, 4);
|
||||||
|
@ -141,6 +142,7 @@ public abstract class FileBin {
|
||||||
System.arraycopy(rawData, 4, compressedData, 0, compressedData.length);
|
System.arraycopy(rawData, 4, compressedData, 0, compressedData.length);
|
||||||
|
|
||||||
byte[] wallet_object_bytes = Util.decompress(compressedData, Util.XZ);
|
byte[] wallet_object_bytes = Util.decompress(compressedData, Util.XZ);
|
||||||
|
if(wallet_object_bytes == null) return null;
|
||||||
String wallet_string = new String(wallet_object_bytes, "UTF-8");
|
String wallet_string = new String(wallet_object_bytes, "UTF-8");
|
||||||
JsonObject wallet = new JsonParser().parse(wallet_string).getAsJsonObject();
|
JsonObject wallet = new JsonParser().parse(wallet_string).getAsJsonObject();
|
||||||
if (wallet.get("wallet").isJsonArray()) {
|
if (wallet.get("wallet").isJsonArray()) {
|
||||||
|
|
Loading…
Reference in a new issue