importing file
This commit is contained in:
parent
a98df1369f
commit
ed21b70ba2
2 changed files with 4 additions and 2 deletions
|
@ -54,8 +54,10 @@ public abstract class FileBin {
|
||||||
|
|
||||||
ECKey randomECKey = ECKey.fromPublicOnly(publicKey);
|
ECKey randomECKey = ECKey.fromPublicOnly(publicKey);
|
||||||
byte[] finalKey = randomECKey.getPubKeyPoint().multiply(ECKey.fromPrivate(md.digest(password.getBytes("UTF-8"))).getPrivKey()).normalize().getXCoord().getEncoded();
|
byte[] finalKey = randomECKey.getPubKeyPoint().multiply(ECKey.fromPrivate(md.digest(password.getBytes("UTF-8"))).getPrivKey()).normalize().getXCoord().getEncoded();
|
||||||
|
MessageDigest md1 = MessageDigest.getInstance("SHA-512");
|
||||||
|
finalKey = md1.digest(finalKey);
|
||||||
rawData = decryptAES(rawData, byteToString(finalKey).getBytes());
|
rawData = decryptAES(rawData, byteToString(finalKey).getBytes());
|
||||||
|
|
||||||
byte[] checksum = new byte[4];
|
byte[] checksum = new byte[4];
|
||||||
System.arraycopy(rawData, 0, checksum, 0, 4);
|
System.arraycopy(rawData, 0, checksum, 0, 4);
|
||||||
byte[] compressedData = new byte[rawData.length-4];
|
byte[] compressedData = new byte[rawData.length-4];
|
||||||
|
|
|
@ -731,6 +731,6 @@ public class Test {
|
||||||
|
|
||||||
public void testCreateBinFile(){
|
public void testCreateBinFile(){
|
||||||
byte[] fileOutput = FileBin.getBytesFromBrainKey(Main.BRAIN_KEY, "123456","bithon-83");
|
byte[] fileOutput = FileBin.getBytesFromBrainKey(Main.BRAIN_KEY, "123456","bithon-83");
|
||||||
System.out.println("fileOutput " + Arrays.toString(fileOutput));
|
System.out.println(FileBin.getBrainkeyFromByte(fileOutput, "123456"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue