高分请教,高手请进!!!!!!!1 你搜索一下吧,论坛应该有的! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 按部就班,跟 DES 一样。import java.security.Key;import javax.crypto.Cipher;import javax.crypto.KeyGenerator;//// encrypt and decrypt using the DES private key algorithmpublic class PrivateExample { public static void main(String[] args) throws Exception { byte[] plainText = "Hello World!".getBytes("UTF8"); // // get a DES private key System.out.println("\nStart generating AES key"); KeyGenerator keyGen = KeyGenerator.getInstance("AES"); keyGen.init(128); Key key = keyGen.generateKey(); System.out.println("Finish generating AES key"); // // get a DES cipher object and print the provider Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); System.out.println("\n" + cipher.getProvider().getInfo()); // // encrypt using the key and the plaintext System.out.println("\nStart encryption"); cipher.init(Cipher.ENCRYPT_MODE, key); byte[] cipherText = cipher.doFinal(plainText); System.out.println("Finish encryption: "); System.out.println(new String(cipherText, "UTF8")); // // decrypt the ciphertext using the same key System.out.println("\nStart decryption"); cipher.init(Cipher.DECRYPT_MODE, key); byte[] newPlainText = cipher.doFinal(cipherText); System.out.println("Finish decryption: "); System.out.println(new String(newPlainText, "UTF8")); }} shutdownOutput()使用造成Connection Rest 关于继承中遇到的一些问题,希望大家来帮帮我 疑惑:equals()的问题 JCreatorPro运行未响应 关于JTable显示数据的问题!顶者有分! 求助:在一个有几千行的文本文件里边提取数据,并统计! java里面SQL 语句拼装问题 代理服务器的问题? 各位请看我的下面一个贴子,再加50分求解。 怎么禁止JDBC 的批量操作 散分拉!!以下网址是我以前在csdn发的帖子,没有人回答.我现在打算结贴了!大家随便回答就可以了! 每次启动java程序,是个进程还是个线程啊???
import java.security.Key;import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
//
// encrypt and decrypt using the DES private key algorithm
public class PrivateExample { public static void main(String[] args) throws Exception {
byte[] plainText = "Hello World!".getBytes("UTF8");
//
// get a DES private key
System.out.println("\nStart generating AES key");
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
keyGen.init(128);
Key key = keyGen.generateKey();
System.out.println("Finish generating AES key");
//
// get a DES cipher object and print the provider
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
System.out.println("\n" + cipher.getProvider().getInfo());
//
// encrypt using the key and the plaintext
System.out.println("\nStart encryption");
cipher.init(Cipher.ENCRYPT_MODE, key);
byte[] cipherText = cipher.doFinal(plainText);
System.out.println("Finish encryption: ");
System.out.println(new String(cipherText, "UTF8")); //
// decrypt the ciphertext using the same key
System.out.println("\nStart decryption");
cipher.init(Cipher.DECRYPT_MODE, key);
byte[] newPlainText = cipher.doFinal(cipherText);
System.out.println("Finish decryption: "); System.out.println(new String(newPlainText, "UTF8"));
}
}