java¶ÔÎļþ½øÐмÓÃܽâÃܲÙ×÷
½Ó¿ÚÀࣺ
package JFFileEncrypt;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import javax.crypto.KeyGenerator;
import javax.crypto.spec.SecretKeySpec;
/**
* ¹¦ÄÜ£º¶ÔÎļþ¼ÓÃܽâÃܲÙ×÷
* @author jiangfeng
*
*/
public interface FileEncryptInterface
{
/**
* ¼ÓÃÜËã·¨
* @param key
* @param FileName
* @return
*/
public boolean DESEncrypt(Key key, String FileName);
/**
* ½âÃÜËã·¨
* @param FileName
* @param key
* @return
*/
public boolean DESDecrypt(String FileName, Key key);
/**
* ×Ô¶¨ÒåÒ»¸ökey
*/
public Key getKey(String keyRule);
/**
* µÚ¶þÖÖ²úÉúkeyµÄ·½·¨
* @return
*/
public Key getKey2();
}
½Ó¿ÚʵÏÖÀࣺ
package JFFileEncrypt;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.KeyGenerator;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.SecretKeySpec;
/**
* ¹¦ÄÜ£º¶ÔÎļþ¼ÓÃܽâÃܲÙ×÷
* @author jiangfeng
*
*/
public class FileEncryptImpal implements FileEncryptInterface
{
/**
* ¹¦ÄÜ£º¼ÓÃÜÎļþ
*/
public boolean DESEncrypt(Key key, String FileName)
{
boolean result = false;
StringBuffer sb = null;
try
{
/*
* CipherÀàÎÞ¹¹Ôì·½·¨£¬µ÷ÓÃgetInstance()·½·¨½«ËùÇëÇóת»»µÄÃû³Æ´«µÝ¸øËü ²ÎÊýΪ ת»»µÄÃû³Æ£¬ÀýÈç
* DES/C
Ïà¹ØÎĵµ£º
ö¾ÙÀàÐÍÊÇJDK5.0µÄÐÂÌØÕ÷¡£SunÒý½øÁËÒ»¸öȫеĹؼü×ÖenumÀ´¶¨ÒåÒ»¸öö¾ÙÀà¡£ÏÂÃæ¾ÍÊÇÒ»¸öµäÐÍö¾ÙÀàÐ͵Ķ¨Ò壺
Java´úÂë
public enum Color{
RED,BLUE,BLACK,YELLOW,GREEN
}
public enum Color{
RED,BLUE,BLACK,YELLOW,GREEN
}
ÏÔ ......
/**
* ´´½¨Ò»¸öеÄÎļþ
* @param relativePath Ïà¶Ô·¾¶
* @param fileName ÎļþÃû
* @return
* @throws IOException
*/
public File cre ......
ÖíÄêÎÞÁÄ,¸ÄÁËÒ»¸ö´úÂ룬ÓеãD°æÄǸöÒâ˼£¬°ÑWAP PUSHµÄC#´úÂë¸Äµ½ÁËJAVA
ÔÀ´³ö´¦£º
http://www.codeproject.com/cs/internet/wappush.asp
¸Ä¹ýºóµÄ´úÂëÔÚÏÂÃ棬³ÌÐòºÃÏñ¿ÉÒÔÊä³öÁËWAPPUSHµÄ½á¹¹»¯µÄ¶«Î÷£¬µ«ÊÇ£¬Ã»ÓÐÔÚCMPPÐÒéÉϲâÊÔͨ¹ý¡£
¹²7¸öÎļþ£º
package com.wap.wbxml;
public class Runner {
&nbs ......
Javaѧϰ·¾¶£¨Ò»£©¹¤¾ßƪ
Ò»¡¢ JDK (Java Development Kit)
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁËJavaÔËÐл·¾³£¨Java Runtime Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕJDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJDKÊÇSun¹«Ë¾·¢²¼µÄJDK£¬³ýÁËSunÖ®Í⣬»¹Óкܶ๠......
javaÖÐÌṩÁËioÀà¿â£¬¿ÉÒÔÇáËɵÄÓÃjavaʵÏÖ¶ÔÎļþµÄ¸÷ÖÖ²Ù×÷¡£ÏÂÃæ¾ÍÀ´ËµÒ»ÏÂÈçºÎÓÃjavaÀ´ÊµÏÖÕâЩ²Ù×÷¡£
н¨Ä¿Â¼<%@ page contentType="text/html;charset=gb2312"%>
<%
//String URL = request.getRequestURI();
String filePath="C:\\²âÊÔ\\";
filePath=filePath.toString(); ......