java的安全性设置问题?????????????

zjasan 2003-03-19 10:51:37
我得源程序如下《书上的》:import javax.crypto.*;
public class JCEInstallTest{
public static final String stringToEncrypt = "This is na test!";
public static void main(String[] args) throws Exception{
System.out.println("Attempting to get a BlowFish key...");
KeyGenerator keyGenerator=KeyGenerator.getInstance("Blowfish");
keyGenerator.init(128);
SecretKey key=keyGenerator.generateKey();
System.out.println("OK");
System.out.print("Attempting to get a Clipher and Encrypt...");
Cipher cipher=Cipher.getInstance("Blowfish/ECB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE,key);
byte[] cipherText=cipher.doFinal(stringToEncrypt.getBytes("UTF8"));
System.out.println("OK");
System.out.println("Test completed successfully!");
}
}
但是在运行的时候,有如吓得提示:
Attempting to get a BlowFish key...
Exception in thread "main" java.security.NoSuchAlgorithmException: Algorithm Blowfish not available
at javax.crypto.SunJCE_b.a(DashoA6275)
at javax.crypto.KeyGenerator.getInstance(DashoA6275)
at JCEInstallTest.main(JCEInstallTest.java:6)
但是我得设置是和书上的一摸一样的
就是运行不了啊,大哥救救我啊!!!!!
...全文
63 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
zjasan 2003-03-19
  • 打赏
  • 举报
回复
怎么没人会啊???
zjasan 2003-03-19
  • 打赏
  • 举报
回复
我得设置是如
.........
#
# List of providers and their preference orders (see above):
#
security.provider.1=sun.security.provider.Sun
security.provider.2=com.sun.rsajca.Provider
security.provider.3=org.bouncycastle.jce.provider.BouncyCastleProvider
.....
这样怎么会有错啊.

62,616

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧