

后台帐号加密(MD5+BASE64):4QrcOUm6Wau+VuBX8g+IPg==
会员密码加密:123456=ETLCw4cN
会员密码解密:ETLCw4cN=123456
加密(PBEWithMD5AndDES)|360121198211074225=tcbytr9F0RCdGJ+iekWQoozjHy9K5SxN
解密(PBEWithMD5AndDES)|tcbytr9F0RCdGJ+iekWQoozjHy9K5SxN=360121198211074225
e:\coding\server\tomcat8\conf\workers.properties”。/usr/local/openssl/bin/openssl req -x509 -days 365 -key/usr/local/apache2/conf/ssl.key/server.key -in/usr/local/apache2/conf/ssl.key/server.csr -out/usr/local/apache2/conf/ssl.crt/server.crt。right click on the project name and click export > war file to create a war file. then deploy this war in the tomcat's webapps directory. finally, start tomcat server and try to access url :8080/helloworldstruts2/index.jsp. this will give you following screen:。
Z/bMl65Pmbt+os5f5lTJ+ZAjEAGsPw\=\=解密:pubwin
//07
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.PBEParameterSpec;
//09

import java.security.MessageDigest;
import javax.crypto.spec.DESKeySpec;
import javax.crypto.spec.IvParameterSpec;
//BASE64
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
public class pubwin2009
{
// key1 姓名加解密 07/09
public static string httpsrequest2(string requesturl, string requestmethod, string outputxml) throws exception { 。public static void saveimageasjpg(string fromfilestr, string savetofilestr, int width, int hight) throws exception {。public static string decrypt(string phextext, string piv) throws exception {。
{
//String Key=”123!@#qweQWE/.,?><abc”; //07
String Key=”q1!2@3#we>WacE/.Q,?<b”; //09
byte _fldint[] = { -87, -101, -56, 50, 86, 53, -29, 3};
byte bytesrc[];

if (type==1)
bytesrc =message.getBytes(“UTF8″);
else
bytesrc =(new BASE64Decoder()).decodeBuffer(message);
PBEParameterSpec pbeparameterspec = new PBEParameterSpec(_fldint,19);
PBEKeySpec pbekeyspec = new PBEKeySpec(Key.toCharArray());
SecretKeyFactory secretkeyfactory = SecretKeyFactory.getInstance(“PBEWithMD5AndDES”);
javax.crypto.SecretKey secretkey = secretkeyfactory.generateSecret(pbekeyspec);
Cipher cipher = Cipher.getInstance(“PBEWithMD5AndDES”);
cipher.init(type, secretkey, pbeparameterspec);
byte[] retByte = cipher.doFinal(bytesrc);
if (type==1)
return new BASE64Encoder().encode(retByte);
else
return new String(retByte,”UTF8″);

}
//09会员密码 db.properties 加解密
public static string aesdecrypt(string encryptstr, string decryptkey) throws exception {。public static void saveimageasjpg(string fromfilestr, string savetofilestr, int width, int hight) throws exception {。public static string decrypt(string phextext, string piv) throws exception {。
String keye = “hi%$so78″; //MD5
String keyb = “12up56^&”; //IvParameterSpec
byte bytesrc[];
if (type==1)
bytesrc =message.getBytes();
else
bytesrc =(new BASE64Decoder()).decodeBuffer(message);
messagedigest messagedigest = messagedigest.getinstance("md5")。 messagedigest md5。 md5 = messagedigest.getinstance(hashtype)。
md5.update(keye.getBytes());
DESKeySpec desKeySpec = new DESKeySpec(md5.digest());
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(“DES”);
SecretKey secretKey = keyFactory.generateSecret(desKeySpec);

IvParameterSpec iv = new IvParameterSpec(keyb.getBytes(“UTF-8″));
cipher cipher = cipher.getinstance(algorithmstr)。 cipher cipher = cipher.getinstance(algorithmstr)。 cipher cipher = cipher.getinstance(transform)。
cipher.init(type, secretKey, iv);
byte[] retByte = cipher.doFinal(bytesrc);
if (type==1)
return new BASE64Encoder().encode(retByte);
else
return new String(retByte);
}
public static void main(string args[]) throws exception {。 public static void main(string[] args) throws exception{ 。 public static void main(string[] args) throws exception{ 。
{
system.out.println("加密:" + md5str)。 system.out.println("加密后的结果是:"+result)。 //system.out.println("加密后1:" + strencryptresult1)。
System.out.println( “姓名解密:09IdjpQQAPgniEaO/skp9gy8+LkD42fZ -> ” +Rcode(“09IdjpQQAPgniEaO/skp9gy8+LkD42fZ”,2)+”\n”);
System.out.println( “09会员密码加解:123456 -> ” +decrypt(“123456″,1));
System.out.println( “09会员密码解密:OEnU8DEcgsE= -> ” +decrypt(“OEnU8DEcgsE=”,2));
System.exit(0);
}
}
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/ruanjian/article-102352-1.html
即使做好最坏打算