Java安全:非法的密钥大小还是默认参数?
String key = "av45k1pfb024xa3bl359vsb4esortvks74sksr5oy4s5serondry84jsrryuhsr5ys49y5seri5shrdliheuirdygliurguiy5ru";try { Cipher c = Cipher.getInstance("ARCFOUR"); SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "ARCFOUR"); c.init(Cipher.DECRYPT_MODE, secretKeySpec); return new String(c.doFinal(Hex.decodeHex(data.toCharArray())), "UTF-8");} catch (InvalidKeyException e) { throw new CryptoException(e);}
Caused by: java.security.InvalidKeyException: Illegal key size or default parameters at javax.crypto.Cipher.a(DashoA13*..) ~[na:1.6] at javax.crypto.Cipher.a(DashoA13*..) ~[na:1.6] at javax.crypto.Cipher.a(DashoA13*..) ~[na:1.6] at javax.crypto.Cipher.init(DashoA13*..) ~[na:1.6] at javax.crypto.Cipher.init(DashoA13*..) ~[na:1.6] at my.package.Something.decode(RC4Decoder.java:25) ~[my.package.jar:na] ... 5 common frames omitted
第25行c.init(Cipher.DECRYPT_MODE, secretKeySpec);
注:
撒科打诨
Helenr
相关分类