The server myserver is temporarilly suspended
查查你的"myserver"吧!!
查查你的"myserver"吧!!
解决方案 »
- 百度ueditor工具栏出现乱码,求解决
- antlr-2.7.2.jar和antlr-2.7.6.jar冲突,前一个jar包删除项目无法启动
- 关于打开/admin/index.jsp 找不到useBean的问题
- java用struts2在actoin中用json吧数据封装了要用extjs怎么取
- 怎样用hibernate通过外键查询?
- 服务器托管后出现的郁闷问题,恳请高手赐教
- struts问题求助
- JAVA数组初始化的问题,急急急...谢谢..
- session的问题。
- 了解下自己值多少钱,java、C#、android
- 为什么我的BEAN总有问题
- javascript的问题。急急急急急急急急急急急急急急急急急急急急急急急急!
1)testdes.javapackage testtestprj;/*
安全程序 DESede/DES测试
*/
import java.security.*;
import javax.crypto.*;
public class testdes {
public static void main(String[] args){
testdes my=new testdes();
my.run();
}
public void run() {
//添加新安全算法,如果用JCE就要把它添加进去
Security.addProvider(new com.sun.crypto.provider.SunJCE());
String Algorithm="DES"; //定义 加密算法,可用 DES,DESede,Blowfish
String myinfo="要加密的信息";
try {
//生成密钥
KeyGenerator keygen = KeyGenerator.getInstance(Algorithm);
SecretKey deskey = keygen.generateKey(); //加密
System.out.println("加密前的二进串:"+byte2hex(myinfo.getBytes()));
System.out.println("加密前的信息:"+myinfo);
Cipher c1 = Cipher.getInstance(Algorithm);
c1.init(Cipher.ENCRYPT_MODE,deskey);
byte[] cipherByte=c1.doFinal(myinfo.getBytes());
System.out.println("加密后的二进串:"+byte2hex(cipherByte));
//解密
c1 = Cipher.getInstance(Algorithm);
c1.init(Cipher.DECRYPT_MODE,deskey);
byte[] clearByte=c1.doFinal(cipherByte);
System.out.println("解密后的二进串:"+byte2hex(clearByte));
System.out.println("解密后的信息:"+(new String(clearByte))); }
catch (java.security.NoSuchAlgorithmException e1) {e1.printStackTrace();}
catch (javax.crypto.NoSuchPaddingException e2) {e2.printStackTrace();}
catch (java.lang.Exception e3) {e3.printStackTrace();}
}
public String byte2hex(byte[] b) //二行制转字符串
{
String hs="";
String stmp="";
for (int n=0;n<b.length;n++)
{
stmp=(java.lang.Integer.toHexString(b[n] & 0XFF));
if (stmp.length()==1) hs=hs+"0"+stmp;
else hs=hs+stmp;
if (n<b.length-1) hs=hs+":";
}
return hs.toUpperCase();
}}
2)test.jsp
<%@ page contentType="text/html; charset=GBK" %>
<html>
<head>
<title>
test
</title>
</head>
<jsp:useBean id="testBeanId" scope="session" class="testtestprj.testBean" />
<jsp:setProperty name="testBeanId" property="*" />
<body>
<h1></h1>
<form method="post">
<%
testtestprj.testdes newdes = new testtestprj.testdes();
newdes.run();
%>
</form>
</body>
</html>
(使用环境:jb7+weblogic6+sqlserver2000)
1)下载jce1_2_2.zip,解压四个文件;
2)将以上四个文件添加到jb中tools的configure server中的class,重启jb即可。
you try