Java安全类抛出异常 [英] Java security class cast exception

查看:835
本文介绍了Java安全类抛出异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Java安全初学者,当我打电话时遇到以下问题:

 密码密码= Cipher.getInstance ( RSA / ECB / PKCS1Padding); 

我收到错误:



code> java.lang.ClassCastException:com.sun.crypto.provider.RSACipher不能转换为javax.crypto.CipherSpi



在我的战争文件中有5个以上的支付网关加密的jar文件:




  • cryptix-jce-api.jar

  • cryptix-jce-provider.jar

  • cryptix-message-api.jar

  • cryptix-openpgp-provider.jar

  • cryptix-pki-api.jar



没有这5个JAR文件, > Cipher.getInstance()工作,但这是不可能的,因为我需要JAR支付信息加密。



任何人都可以显示我的路径我应该如何克服这个问题?

解决方案

感谢所有的意见和答案。


最后,我将5个jar从WAR文件中移出到服务器Jars库目录,并解决了这个问题。
=\"之间有一个 java.lang.RuntimeException:NYI

这是用这个解决方案解决的: http://javabeanz.wordpress.com/2009/06/11/java-lang-runtimeexception-nyi/

希望这有助于任何人在那里。
再次感谢!


Hi I am beginner in Java security, i encounter the following issue, when calling :

Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");

I got the error :

java.lang.ClassCastException: com.sun.crypto.provider.RSACipher cannot be cast to javax.crypto.CipherSpi

There are 5 more jars file for a payment gateway encryption in my war file:

  • cryptix-jce-api.jar
  • cryptix-jce-provider.jar
  • cryptix-message-api.jar
  • cryptix-openpgp-provider.jar
  • cryptix-pki-api.jar

Without these 5 JAR files then the Cipher.getInstance() works, but that is not possible because I need the JARs for payment information encryption.

Anyone out there can show me the path of how should I overcome this issue?

解决方案

Thanks for all the comments and answers.
In the end, I moved the 5 Jars out from WAR file to server Jars library directory and solved this.
In between there was an java.lang.RuntimeException: NYI.
It was solved using the solution from here: http://javabeanz.wordpress.com/2009/06/11/java-lang-runtimeexception-nyi/
Hope this helps, to anyone out there.
Once again thanks!

这篇关于Java安全类抛出异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆