简体   繁体   中英

Why I'm getting java.security.InvalidKey Exception?

I'm trying decrypt whatup db file (which I copied to my PC, and run from my PC, under linux).

The initialize vector and key are:

private byte[] key = { (byte) 141, 75, 21, 92, (byte) 201, (byte) 255,
        (byte) 129, (byte) 229, (byte) 203, (byte) 246, (byte) 250, 120,
        25, 54, 106, 62, (byte) 198, 33, (byte) 166, 86, 65, 108,
        (byte) 215, (byte) 147 };


private final byte[] iv = { 0x1E, 0x39, (byte) 0xF3, 0x69, (byte) 0xE9, 0xD,
        (byte) 0xB3, 0x3A, (byte) 0xA7, 0x3B, 0x44, 0x2B, (byte) 0xBB,
        (byte) 0xB6, (byte) 0xB0, (byte) 0xB9 };

And when I'm running this code:

  Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
  SecretKeySpec secret = new SecretKeySpec(key, "AES");
  IvParameterSpec vector = new IvParameterSpec(iv);
  cipher.init(Cipher.DECRYPT_MODE, secret, vector);

I'm getting exception on the init function: " java.security.InvalidKeyException: Illegal key size "

I used this post:

Get all messages from Whatsapp

What is wrong ?

我猜是JDK密钥大小,它不允许您使用大小超过128位的密钥进行加密。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM