Java谷歌Chrome解密

时间:2016-04-03 03:40:45

标签: java sql google-chrome encryption

我正在尝试解密chromes加密字段,但我得到以下异常: -

Exception in thread "main" java.lang.AbstractMethodError: com.sun.jna.Structure.getFieldOrder()Ljava/util/List;
at com.sun.jna.Structure.fieldOrder(Structure.java:868)
at com.sun.jna.Structure.getFields(Structure.java:894)
at com.sun.jna.Structure.deriveLayout(Structure.java:1042)
at com.sun.jna.Structure.calculateSize(Structure.java:966)
at com.sun.jna.Structure.calculateSize(Structure.java:933)
at com.sun.jna.Structure.allocateMemory(Structure.java:360)
at com.sun.jna.Structure.<init>(Structure.java:184)
at com.sun.jna.Structure.<init>(Structure.java:172)
at com.sun.jna.Structure.<init>(Structure.java:159)
at com.sun.jna.Structure.<init>(Structure.java:151)
at com.sun.jna.platform.win32.WinCrypt$DATA_BLOB.<init>(WinCrypt.java:42)
at com.sun.jna.platform.win32.Crypt32Util.cryptUnprotectData(Crypt32Util.java:121)
at com.sun.jna.platform.win32.Crypt32Util.cryptUnprotectData(Crypt32Util.java:103)
at com.sun.jna.platform.win32.Crypt32Util.cryptUnprotectData(Crypt32Util.java:90)
at JPasswordManager.ChromeManager.main(ChromeManager.java:8)

以下是我的Chrome类的一个片段(编辑这里是一个示例代码注释 - 密码字段可以是其他一些加密字段,我只是快速将其设置为...): -

public static void main(String[] args)
{
  try
  {
    Class.forName("org.sqlite.JDBC");
    connection = DriverManager.getConnection("jdbc:sqlite:\\Users\\Standard User\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\Login Data");
    resultSet = statement.executeQuery("SELECT username_value, password_value FROM logins"); // some encrypted field

    while (resultSet.next())
    {
        byte[] encryptedData = resultSet.getBytes(1);
        byte[] decryptedData = Crypt32Util.cryptUnprotectData(encryptedData);  // exception over here

        StringBuilder decryptedString = new StringBuilder();

        for (byte b : decryptedData)
        {
           decryptedString .append((char) b);
        }

        System.out.println("decrypted = [" + decryptedString + "]");
   }
 }

 catch(Exception e)
 {
    e.printStackTrace();
 }

}

我也尝试过转换为hexString然后解密,如果你对我如何转换为十六进制感兴趣,那么这也是行不通的,那么这里是我编码的方法

public static String ToHexString(byte[] bytes)
{
    StringBuilder sb = new StringBuilder();
    Formatter formatter = new Formatter(sb);
    for (byte b : bytes)
    {
        formatter.format("%02x", b);
    }
    return sb.toString();
}

我曾经通过这种方法传递encryptedData变量然后尝试cryptUnprotect数据,但它仍然没有工作..

0 个答案:

没有答案