Simple renaming of a variable for semantic purposes

This commit is contained in:
Nelson R. Perez 2017-06-26 14:01:17 -05:00
parent 7b9b694a71
commit ea0bab5179

View file

@ -4,7 +4,8 @@ import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import de.bitsharesmunich.graphenej.crypto.SecureRandomStrengthener;
import org.bitcoinj.core.ECKey;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.math.BigInteger; import java.math.BigInteger;
@ -12,8 +13,8 @@ import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom; import java.security.SecureRandom;
import de.bitsharesmunich.graphenej.crypto.SecureRandomStrengthener;
import de.bitsharesmunich.graphenej.models.backup.WalletBackup; import de.bitsharesmunich.graphenej.models.backup.WalletBackup;
import org.bitcoinj.core.ECKey;
/** /**
* Class to manage the backup files * Class to manage the backup files
@ -89,9 +90,9 @@ public abstract class FileBin {
secureRandom.nextBytes(randomKey); secureRandom.nextBytes(randomKey);
ECKey randomECKey = ECKey.fromPrivate(md.digest(randomKey)); ECKey randomECKey = ECKey.fromPrivate(md.digest(randomKey));
byte[] randPubKey = randomECKey.getPubKey(); byte[] randPubKey = randomECKey.getPubKey();
byte[] finalKey = randomECKey.getPubKeyPoint().multiply(ECKey.fromPrivate(md.digest(password.getBytes("UTF-8"))).getPrivKey()).normalize().getXCoord().getEncoded(); byte[] sharedSecret = randomECKey.getPubKeyPoint().multiply(ECKey.fromPrivate(md.digest(password.getBytes("UTF-8"))).getPrivKey()).normalize().getXCoord().getEncoded();
MessageDigest md1 = MessageDigest.getInstance("SHA-512"); MessageDigest md1 = MessageDigest.getInstance("SHA-512");
finalKey = md1.digest(finalKey); byte[] finalKey = md1.digest(sharedSecret);
checksummed = Util.encryptAES(checksummed, Util.byteToString(finalKey).getBytes()); checksummed = Util.encryptAES(checksummed, Util.byteToString(finalKey).getBytes());
byte[] finalPayload = new byte[checksummed.length + randPubKey.length]; byte[] finalPayload = new byte[checksummed.length + randPubKey.length];