arcfour 随机数 java,是RC4还是ARCFOUR?使用SecretKeySpec时无效的KeyException?

I tried running my application on my pc, but I keep getting this thing. Is it possible that I'm missing some libraries?

fabsam.crypto.CryptoException: java.security.InvalidKeyException: No installed provider supports this key: javax.crypto.spec.SecretKeySpec

at fabsam.crypto.RC4Decoder.decode(RC4Decoder.java:37) ~[bin/:na]

... (skipped my projects stack trace)

at java.lang.Thread.run(Thread.java:662) [na:1.6.0_25]

Caused by: java.security.InvalidKeyException: No installed provider supports this key: javax.crypto.spec.SecretKeySpec

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 fabsam.crypto.RC4Decoder.decode(RC4Decoder.java:27) ~[bin/:na]

... 5 common frames omitted

Caused by: java.security.InvalidKeyException: No installed provider supports this key: javax.crypto.spec.SecretKeySpec

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 fabsam.crypto.RC4Decoder.decode(RC4Decoder.java:25) ~[fabsam-08.05.11.jar:na]

... 5 common frames omitted

Code:

cipher.init(Cipher.DECRYPT_MODE,

new SecretKeySpec(key.getBytes(DEFAULT_CHARSET), ALGORITHM));

Could it be because I'm using RC4 not ARCFOUR in the ALGORITHM variable?

When I try ARCFOUR I get this:

fabsam.crypto.CryptoException: java.security.InvalidKeyException: Illegal key size or default parameters

at fabsam.crypto.RC4Decoder.decode(RC4Decoder.java:37) ~[bin/:na]

... (skipped my projects stack trace)

at java.lang.Thread.run(Thread.java:662) [na:1.6.0_25]

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 fabsam.crypto.RC4Decoder.decode(RC4Decoder.java:27) ~[bin/:na]

... 5 common frames omitted

Okay, the problem is not with the code. On server this runs just fine with no errors. However on my pc it throws me that InvalidKeyException exception. So it's something with jvm related.. Any ideas?

Edit:

I now see that I'm getting both exceptions. Not at once, but first time the illegal key size and then no installed provider. I've the ALGORITHM set to "ARCFOUR" when running my project.

解决方案

After lot of struggling and searching and everything, I got the right answer.

Check my question here: Java Security: Illegal key size or default parameters? if you are experiencing this problem!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值