|
@@ -7,8 +7,10 @@ import javax.crypto.NoSuchPaddingException;
|
|
import javax.crypto.spec.SecretKeySpec;
|
|
import javax.crypto.spec.SecretKeySpec;
|
|
import java.io.*;
|
|
import java.io.*;
|
|
import java.security.InvalidKeyException;
|
|
import java.security.InvalidKeyException;
|
|
|
|
+import java.security.MessageDigest;
|
|
import java.security.NoSuchAlgorithmException;
|
|
import java.security.NoSuchAlgorithmException;
|
|
import java.security.Security;
|
|
import java.security.Security;
|
|
|
|
+import java.util.Locale;
|
|
|
|
|
|
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
|
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
|
public class SonyUnXml {
|
|
public class SonyUnXml {
|
|
@@ -22,20 +24,37 @@ public class SonyUnXml {
|
|
SecretKeySpec secretKeySpec = new SecretKeySpec(c, "AES");
|
|
SecretKeySpec secretKeySpec = new SecretKeySpec(c, "AES");
|
|
Cipher cipher = Cipher.getInstance("AES/ECB/ZeroBytePadding");
|
|
Cipher cipher = Cipher.getInstance("AES/ECB/ZeroBytePadding");
|
|
cipher.init(Cipher.DECRYPT_MODE, secretKeySpec);
|
|
cipher.init(Cipher.DECRYPT_MODE, secretKeySpec);
|
|
- File f = new File("Q:\\LOA\\000013\\S0NY\\decr\\01\\info.xml");
|
|
|
|
|
|
+ File f = new File("/home/tgoerner/Downloads/sony-FWH/info3/info.xml");
|
|
RandomAccessFile f2 = new RandomAccessFile(f,"r");
|
|
RandomAccessFile f2 = new RandomAccessFile(f,"r");
|
|
//f2.seek(0x4A);
|
|
//f2.seek(0x4A);
|
|
int fl = (int)f.length();
|
|
int fl = (int)f.length();
|
|
byte[] file = new byte[fl];
|
|
byte[] file = new byte[fl];
|
|
|
|
|
|
int read = f2.read(file);
|
|
int read = f2.read(file);
|
|
|
|
+ System.out.println(bytesToHex(MessageDigest.getInstance("SHA-1").digest(file)));
|
|
if(read<fl)
|
|
if(read<fl)
|
|
{
|
|
{
|
|
System.err.println("ZARF");
|
|
System.err.println("ZARF");
|
|
}
|
|
}
|
|
|
|
|
|
byte[] out = cipher.doFinal(file);
|
|
byte[] out = cipher.doFinal(file);
|
|
- FileOutputStream os = new FileOutputStream(new File("Q:\\LOA\\000013\\S0NY\\decr\\01\\info.xml.dec"));
|
|
|
|
|
|
+ System.out.println(bytesToHex(MessageDigest.getInstance("SHA-1").digest(out)));
|
|
|
|
+ FileOutputStream os = new FileOutputStream(new File("/home/tgoerner/Downloads/sony-FWH/info3/info.xml.dec"));
|
|
os.write(out);
|
|
os.write(out);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
|
|
|
|
+ public static String bytesToHex(byte[] bytes) {
|
|
|
|
+ char[] hexChars = new char[bytes.length * 2];
|
|
|
|
+ for (int j = 0; j < bytes.length; j++) {
|
|
|
|
+ int v = bytes[j] & 0xFF;
|
|
|
|
+ hexChars[j * 2] = HEX_ARRAY[v >>> 4];
|
|
|
|
+ hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String hexxit = new String(hexChars).toLowerCase(Locale.ROOT);
|
|
|
|
+ //hexxit = hexxit.replaceAll("^0+", "");
|
|
|
|
+ return hexxit;
|
|
|
|
+ }
|
|
}
|
|
}
|