xinxin082
2010-08-21 11:39DES加密错误(java.security.NoSuchAlgorithmException: Cannot find any provider suppor)
我的环境是jdk1.5,在请求一个webService的时候要在soap header中传一个密码,并对密码进行DES加密。但是现在加密代码:
deskey = new DESKeySpec(key);
keySpec = new SecretKeySpec(deskey.getKey(), "DES");
//报错的地方
Cipher cipher = Cipher.getInstance(strAlgorithm);
//报错的地方
cipher.init(Cipher.ENCRYPT_MODE, keySpec);
byte[] utf8 = strDataToEncrypt.getBytes("UTF8");
byte[] enc = cipher.doFinal(utf8);
strResult = new sun.misc.BASE64Encoder().encode(enc);
报了java.security.NoSuchAlgorithmException: Cannot find any provider suppor的错误,网上查了好多资料都没什么解决的办法,也试了别人说只单启Tomcat就不会报错了,但是我是要在eclipse中启Tomcat的,这样才能调试代码么。有谁知道解决办法吗?
- 点赞
- 回答
- 收藏
- 复制链接分享
3条回答
为你推荐
- DES加密错误(java.security.NoSuchAlgorithmException: Cannot find any provider suppor)
- it技术
- 互联网问答
- IT行业问题
- 计算机技术
- 编程语言问答
- 0个回答