我尝试在我的电脑上运行我的应用程序,但我不断得到这个东西。有没有可能我错过了一些图书馆?
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
代码:
cipher.init(Cipher.DECRYPT_MODE,
new SecretKeySpec(key.getBytes(DEFAULT_CHARSET), ALGORITHM));
可能是因为我RC4
没有ARCFOUR
在 ALGORITHM 变量中使用吗?当我尝试 ARCFOUR 时,我得到了这个:
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
好的,问题不在于代码。在服务器上,这运行得很好,没有错误。然而,在我的电脑上,它抛出了 InvalidKeyException 异常。所以它与jvm相关..有什么想法吗?
编辑: 我现在看到我得到了两个例外。不是一次,而是第一次非法密钥大小,然后没有安装提供程序。运行我的项目时,我将 ALGORITHM 设置为“ARCFOUR”。