Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java¼ÓÃܺÍÊý×ÖÇ©Ãû3 ¹«Ô¿¼ÓÃÜ

×î½ü³õ²½½Ó´¥ÁËÏÂJava¼ÓÃܺÍÊý×ÖÇ©ÃûµÄÏà¹ØÄÚÈÝ£¬ÎÒѧϰµÄ¹ý³Ì´ó¸Å·ÖÎå²½£º
1£©ÏûÏ¢ÕªÒª
2£©Ë½Ô¿¼ÓÃÜ
3£©¹«Ô¿¼ÓÃÜ
4£©Êý×ÖÇ©Ãû
5£©Êý×ÖÖ¤Êé
ÏÂÃæµÄ´úÂëÊǵÚÈý²¿·Ö£º¹«Ô¿¼ÓÃÜ
Ï£ÍûÄÜΪ¸Õ¸Õ½Ó´¥Õâ¸öµÄÅóÓÑÃÇÊ¡µãÊÂ
package security;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import javax.crypto.Cipher;
/**
* ´ËÀý×ÓÊÇÒ»¸ö¹«Ô¿¼ÓÃÜÀý×Ó,CipherÀàʹÓÃKeyPairGenerator(¹ËÃû˼Ò壺һ¶ÔÔ¿³×Éú³ÉÆ÷)Éú³ÉµÄ¹«Ô¿ºÍ˽Կ
*
* ¹«Ô¿¼ÓÃÜÒ²½Ð²»¶Ô³Æ¼ÓÃÜ£¬²»¶Ô³ÆË㷨ʹÓÃÒ»¶ÔÃÜÔ¿¶Ô£¬Ò»¸ö¹«Ô¿£¬Ò»¸ö˽Կ£¬Ê¹Óù«Ô¿¼ÓÃܵÄÊý¾Ý£¬Ö»ÓÐ˽ԿÄÜ
* ½â¿ª£¨¿ÉÓÃÓÚ¼ÓÃÜ£©£»Í¬Ê±£¬Ê¹ÓÃ˽Կ¼ÓÃܵÄÊý¾Ý£¬Ö»Óй«Ô¿Äܽ⿪£¨Ç©Ãû£©¡£µ«ÊÇËٶȺÜÂý£¨±È˽Կ¼ÓÃÜÂý100µ½
* 1000±¶£©£¬¹«Ô¿µÄÖ÷ÒªËã·¨ÓÐRSA£¬»¹°üÀ¨Blowfish,Diffie-Helman µÈ
*/
public class PublicKey {
public static void main(String[] args) throws Exception {

String before = "asdf";
byte[] plainText = before.getBytes("UTF8");

//²úÉúÒ»¸öRSAÃÜÔ¿Éú³ÉÆ÷KeyPairGenerator(¹ËÃû˼Ò壺һ¶ÔÔ¿³×Éú³ÉÆ÷)
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
//¶¨ÒåÃÜÔ¿³¤¶È1024λ
keyGen.initialize(1024);
//ͨ¹ýKeyPairGenerator²úÉúÃÜÔ¿,×¢Ò⣺ÕâÀïµÄkeyÊÇÒ»¶ÔÔ¿³×£¡£¡
KeyPair key = keyGen.generateKeyPair();
//»ñµÃÒ»¸öRSAµÄCipherÀ࣬ʹÓù«Ô¿¼ÓÃÜ
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
// System.out.println("\n" + cipher.getProvider().getInfo());
System.out.println("\nÓù«Ô¿¼ÓÃÜ...");
//Cipher.ENCRYPT_MODEÒâ˼ÊǼÓÃÜ£¬´ÓÒ»¶ÔÔ¿³×Öеõ½¹«Ô¿ key.getPublic()
cipher.init(Cipher.ENCRYPT_MODE, key.getPublic());
//Óù«Ô¿½øÐмÓÃÜ£¬·µ»ØÒ»¸ö×Ö½ÚÁ÷
byte[] cipherText = cipher.doFinal(plainText);
//ÒÔUTF8¸ñʽ°Ñ×Ö½ÚÁ÷ת»¯ÎªString
String after1 = new String(cipherText, "UTF8");
System.out.println("Óù«Ô¿¼ÓÃÜÍê³É£º"+after1);

//ʹÓÃ˽Կ½âÃÜ
System.out.println("\nÓÃ˽Կ½âÃÜ...");
//Cipher.DECRYPT_MODEÒâ˼ÊÇ


Ïà¹ØÎĵµ£º

JAVA»·¾³±äÁ¿JAVA_HOME¡¢CLASSPATH¡¢PATHÉèÖÃÏê½â

 WindowsÏÂJAVAÓõ½µÄ»·¾³±äÁ¿Ö÷ÒªÓÐ3¸ö£¬JAVA_HOME¡¢CLASSPATH¡¢PATH¡£ÏÂÃæÖð¸ö·ÖÎö¡£
    JAVA_HOMEÖ¸ÏòµÄÊÇJDKµÄ°²×°Â·¾¶£¬ÈçC:\jdk1.5.0_06£¬ÔÚÕâ·¾¶ÏÂÄãÓ¦¸ÃÄܹ»ÕÒµ½bin¡¢libµÈĿ¼¡£ÖµµÃÒ»ÌáµÄÊÇ£¬JDKµÄ°²×°Â·¾¶¿ÉÒÔÑ¡ÔñÈÎÒâ´ÅÅÌĿ¼£¬²»¹ý½¨ÒéÄã·ÅµÄĿ¼²ã´Îdzһµã£¬Èç¹ûÄã·ÅµÄĿ¼ºÜÉî£ ......

java ѧϰ˳Ðò Rubicon

j2eeµÄѧϰ˳Ðò
ÎÒÈÏΪj2eeÒ»¶¨ÒªÑ­Ðò½¥½ø£¬ÎÒ×Ô¼º¾ÍÊÇÕâÑù£¬´ÓÒ»¸öÒ»°ã¸ßУ¼ÆËã»úϵ±ÏÒµ£¬
È»ºóÂú»³ÃÎÏëºÍ¼¤ÇéÈ¥ÕÒ¹¤×÷£¬ÎÒkao,ÄǸöµ¥Î»¶¼¸øÎÒ°×ÑÛ£¬Á¬»áÀϼҵÄÐĶ¼ÓÐÁË£¬ÄǸöʱºòºÍ¼¸¸ö¸çÃÇ£¬×¡ÔÚµØÏÂÊÒ£¨¾ÍÔÚ±±º½ÄÇÀ¡£»·¾³Ï൱¶ñÁÓ£¬Å®ÅóÓÑÌìÌì´ßÎÒÕÒ¹¤×÷£¬ÎÒƨ¶¼²»»á£¬ÔõôÕÒ?Á¬ËÀµÄÐĶ¼ÓÐÁË£¨²»ÖªµÀ´ó¼ÒÓÐûÓÐÕ ......

java¿ª·¢Õß³£È¥µÄ20¸öÍøÕ¾

Ô­ÎÄÁ´½Ó£ºhttp://java.csdn.net/index.php/2009/09/01/java%e5%bc%80%e5%8f%91%e8%80%85%e6%9c%80%e5%b8%b8%e5%8e%bb%e7%9a%8420%e4%b8%aa%e8%8b%b1%e6%96%87%e7%bd%91%e7%ab%99/
JAVA¿ª·¢Õß×ȥµÄ20¸öÓ¢ÎÄÍøÕ¾
1.[http://www.javaalmanac.com] – Java¿ª·¢ÕßÄê¼øÒ»ÊéµÄÔÚÏß°æ±¾. ÒªÏë¿ìËٲ鵽ijÖÖJava¼¼ÇɵÄÓ÷¨ ......

JavaÏß³ÌÖ®Thread Per Message Pattern

Thread-Per-Message PatternµÄ²ÎÓëÕߣº
1. Client£¨Î¯ÍÐÈË£©²ÎÓëÕß
    Client²ÎÓëÕß»á¶ÔHost²ÎÓëÕß·¢³öÇëÇó¡£Client²ÎÓëÕß²¢²»ÖªµÀHost²ÎÓëÕß»áÈçºÎʵÏÖÕâ¸öÇëÇó¡£
2. Host²ÎÓëÕß
    µ±Host²ÎÓëÕß½ÓÊÕµ½Client²ÎÓëÕßµÄÇëÇóʱ£¬»á½¨Á¢ÐµÄÏ̲߳¢Æô¶¯Ëü¡£
    Õâ¸öеÄÏ ......

JavaÓëÆäËûÓïÑԵĻ¥²Ù×÷ÐÔ

JavaÓëÆäËûÓïÑԵĻ¥²Ù×÷ÐÔ ÊÕ²Ø
Ä¿Ç°£¬ÎÒÃÇÏîÄ¿ÖÐÐèÒªÓõ½°ÑJava³ÌÐòǶÈëµ½.Net³ÌÐòÖеļ¼Êõ£¬ÎÒÃÇ×îºóËù²ÉÓõļ¼ÊõÊÇCodemesh¹«Ë¾µÄJuggerNET¡£ÕâÖÖÀàËƵļ¼ÊõºÜ¶à£¬±È½ÏÖªÃûµÄÖ÷ÒªÓÐintrinsyc¹«Ë¾µÄJIntegraÒÔ¼°IBMµÄJava COM bridge¡£
ÏîÄ¿½øÐе½ÏÖÔÚ£¬·¢ÏÖÁ˺ܶàÎÊÌ⣬Ö÷ÒªÓÐÈçϼ¸´óÀàÎÊÌ⣺
1¡¢µ¯³ö´°¿ÚÎÊÌâ
¶ÔÓ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ