亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tripledes.java

?? 共有164個java源程序
?? JAVA
字號:
/* * Copyright (c) 2000 David Flanagan.  All rights reserved. * This code is from the book Java Examples in a Nutshell, 2nd Edition. * It is provided AS-IS, WITHOUT ANY WARRANTY either expressed or implied. * You may study, use, and modify it for any non-commercial purpose. * You may distribute it non-commercially as long as you retain this notice. * For a commercial use license, or to purchase the book (recommended), * visit http://www.davidflanagan.com/javaexamples2. */package com.davidflanagan.examples.security;import javax.crypto.*;import javax.crypto.spec.*;import java.security.*;import java.security.spec.*;import java.io.*;/** * This class defines methods for encrypting and decrypting using the Triple * DES algorithm and for generating, reading and writing Triple DES keys. * It also defines a main() method that allows these methods to be used  * from the command line. **/public class TripleDES {    /**     * The program.  The first argument must be -e, -d, or -g to encrypt,     * decrypt, or generate a key.  The second argument is the name of a file     * from which the key is read or to which it is written for -g.  The     * -e and -d arguments cause the program to read from standard input and     * encrypt or decrypt to standard output.     **/    public static void main(String[] args) {	try {	    // Check to see whether there is a provider that can do TripleDES	    // encryption.  If not, explicitly install the SunJCE provider.	    try { Cipher c = Cipher.getInstance("DESede"); }	    catch(Exception e) {		// An exception here probably means the JCE provider hasn't		// been permanently installed on this system by listing it 		// in the $JAVA_HOME/jre/lib/security/java.security file.		// Therefore, we have to install the JCE provider explicitly.		System.err.println("Installing SunJCE provider.");		Provider sunjce = new com.sun.crypto.provider.SunJCE();		Security.addProvider(sunjce);	    }	    // This is where we'll read the key from or write it to	    File keyfile = new File(args[1]);	    // Now check the first arg to see what we're going to do	    if (args[0].equals("-g")) {        // Generate a key		System.out.print("Generating key. This may take some time...");		System.out.flush();		SecretKey key = generateKey();		writeKey(key, keyfile);		System.out.println("done.");		System.out.println("Secret key written to " + args[1] + 				   ". Protect that file carefully!");	    }	    else if (args[0].equals("-e")) {  // Encrypt stdin to stdout		SecretKey key = readKey(keyfile);		encrypt(key, System.in, System.out);	    }	    else if (args[0].equals("-d")) {  // Decrypt stdin to stdout		SecretKey key = readKey(keyfile);		decrypt(key, System.in, System.out);	    }	}	catch(Exception e) {	    System.err.println(e);	    System.err.println("Usage: java " + TripleDES.class.getName() +			       " -d|-e|-g <keyfile>");	}    }    /** Generate a secret TripleDES encryption/decryption key */    public static SecretKey generateKey() throws NoSuchAlgorithmException {	// Get a key generator for Triple DES (a.k.a DESede)	KeyGenerator keygen = KeyGenerator.getInstance("DESede");	// Use it to generate a key	return keygen.generateKey();    }    /** Save the specified TripleDES SecretKey to the specified file */    public static void writeKey(SecretKey key, File f)	throws IOException, NoSuchAlgorithmException, InvalidKeySpecException    {	// Convert the secret key to an array of bytes like this	SecretKeyFactory keyfactory = SecretKeyFactory.getInstance("DESede");	DESedeKeySpec keyspec =	    (DESedeKeySpec)keyfactory.getKeySpec(key, DESedeKeySpec.class);	byte[] rawkey = keyspec.getKey();	// Write the raw key to the file	FileOutputStream out = new FileOutputStream(f);	out.write(rawkey);	out.close();    }    /** Read a TripleDES secret key from the specified file */    public static SecretKey readKey(File f)	throws IOException, NoSuchAlgorithmException,	       InvalidKeyException, InvalidKeySpecException    {	// Read the raw bytes from the keyfile	DataInputStream in = new DataInputStream(new FileInputStream(f));	byte[] rawkey = new byte[(int)f.length()];	in.readFully(rawkey);	in.close();		// Convert the raw bytes to a secret key like this	DESedeKeySpec keyspec = new DESedeKeySpec(rawkey);	SecretKeyFactory keyfactory = SecretKeyFactory.getInstance("DESede");	SecretKey key = keyfactory.generateSecret(keyspec);	return key;    }    /**      * Use the specified TripleDES key to encrypt bytes from the input stream     * and write them to the output stream.  This method uses      * CipherOutputStream to perform the encryption and write bytes at the     * same time.     **/    public static void encrypt(SecretKey key, InputStream in, OutputStream out)        throws NoSuchAlgorithmException, InvalidKeyException,	       NoSuchPaddingException, IOException    {	// Create and initialize the encryption engine	Cipher cipher = Cipher.getInstance("DESede");	cipher.init(Cipher.ENCRYPT_MODE, key);	// Create a special output stream to do the work for us	CipherOutputStream cos = new CipherOutputStream(out, cipher);	// Read from the input and write to the encrypting output stream	byte[] buffer = new byte[2048];	int bytesRead;	while((bytesRead = in.read(buffer)) != -1) {	    cos.write(buffer, 0, bytesRead);	}	cos.close();	// For extra security, don't leave any plaintext hanging around memory.	java.util.Arrays.fill(buffer, (byte) 0);    }    /**      * Use the specified TripleDES key to decrypt bytes ready from the input      * stream and write them to the output stream.  This method uses      * uses Cipher directly to show how it can be done without      * CipherInputStream and CipherOutputStream.     **/    public static void decrypt(SecretKey key, InputStream in, OutputStream out)        throws NoSuchAlgorithmException, InvalidKeyException, IOException,	       IllegalBlockSizeException, NoSuchPaddingException,	       BadPaddingException    {	// Create and initialize the decryption engine	Cipher cipher = Cipher.getInstance("DESede");	cipher.init(Cipher.DECRYPT_MODE, key);	// Read bytes, decrypt, and write them out.	byte[] buffer = new byte[2048];	int bytesRead;	while((bytesRead = in.read(buffer)) != -1) {	    out.write(cipher.update(buffer, 0, bytesRead));	}	// Write out the final bunch of decrypted bytes	out.write(cipher.doFinal());	out.flush();    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲综合在线免费观看| 国产欧美日韩中文久久| 日韩毛片在线免费观看| 欧美人体做爰大胆视频| 狠狠v欧美v日韩v亚洲ⅴ| 国产精品人妖ts系列视频| 欧美日韩免费在线视频| 国产精品资源站在线| 亚洲免费av高清| 色一情一乱一乱一91av| 亚洲高清不卡在线| 欧美激情一区二区在线| 欧美精品日韩一区| 成人动漫精品一区二区| 婷婷激情综合网| 亚洲视频你懂的| 精品日韩一区二区三区免费视频| 北条麻妃一区二区三区| 蜜桃在线一区二区三区| 中文字幕乱码一区二区免费| 日本高清视频一区二区| 国产精品一区久久久久| 亚洲成人动漫在线免费观看| 国产精品久线观看视频| 日韩免费看的电影| 欧美色视频在线| 粉嫩av一区二区三区粉嫩| 亚洲高清一区二区三区| 久久久不卡网国产精品一区| 在线观看免费成人| 91麻豆福利精品推荐| 国产精品自拍三区| 美女网站一区二区| 另类的小说在线视频另类成人小视频在线| 亚洲欧洲日韩女同| 久久久精品综合| 欧美日韩成人一区| 国产高清精品在线| 久久99精品久久久久婷婷| 午夜精品免费在线| 亚洲小说春色综合另类电影| 一区二区高清免费观看影视大全| 国产色综合久久| 337p日本欧洲亚洲大胆精品| 777a∨成人精品桃花网| av激情成人网| 久久精品国产一区二区| 日韩精品电影一区亚洲| 午夜精品福利一区二区蜜股av | 91视频在线观看| 成人综合婷婷国产精品久久蜜臀| 久久99精品一区二区三区三区| 日韩激情av在线| 视频一区二区中文字幕| 亚洲大尺度视频在线观看| 亚洲成人在线网站| 日本成人超碰在线观看| 免费视频最近日韩| 九九精品视频在线看| 视频一区国产视频| 久久成人免费日本黄色| 精品一区二区影视| 奇米888四色在线精品| 蜜臀av在线播放一区二区三区| 图片区小说区国产精品视频| 日韩中文字幕亚洲一区二区va在线 | 欧美日韩国产一二三| 91麻豆精品91久久久久久清纯| 欧美日韩视频在线第一区| 欧美精品久久久久久久久老牛影院| caoporm超碰国产精品| 91老师国产黑色丝袜在线| 在线一区二区三区| 337p亚洲精品色噜噜噜| 日韩精品一区二区三区在线观看 | 亚洲线精品一区二区三区| 亚洲国产精品一区二区www| 婷婷久久综合九色国产成人| 麻豆视频一区二区| 国产成人三级在线观看| 粉嫩蜜臀av国产精品网站| 91亚洲精品久久久蜜桃| 欧美日韩精品一区二区天天拍小说| 欧美人成免费网站| 精品av久久707| 国产精品理论片在线观看| 国产精品成人免费精品自在线观看 | 欧美成人a视频| 中文字幕欧美激情一区| 亚洲与欧洲av电影| 麻豆91小视频| 99国产精品99久久久久久| 欧美日韩一区二区电影| 久久伊99综合婷婷久久伊| 亚洲国产激情av| 天堂成人免费av电影一区| 国产一区二区美女| 91久久人澡人人添人人爽欧美| 日韩一区二区在线观看视频| 中文一区在线播放| 亚洲成人先锋电影| 国产一区二区精品久久| 色噜噜狠狠成人网p站| 91精品国产色综合久久不卡电影 | 欧美大肚乱孕交hd孕妇| 国产精品视频免费| 三级一区在线视频先锋 | 国内成+人亚洲+欧美+综合在线 | 亚洲主播在线播放| 国产精品99久久久久久似苏梦涵| 色噜噜夜夜夜综合网| 久久久久国产精品人| 亚洲成人激情社区| 国产麻豆91精品| 欧美日韩久久久久久| 国产精品家庭影院| 激情综合色丁香一区二区| 在线免费观看不卡av| 欧美激情中文字幕一区二区| 亚洲免费在线观看| 中文字幕巨乱亚洲| 狠狠色丁香九九婷婷综合五月| 欧美日韩亚洲综合在线 欧美亚洲特黄一级 | 亚洲欧美一区二区三区极速播放 | 亚洲国产精品影院| 99久久国产综合精品女不卡| 国产欧美一区二区精品久导航 | 欧美人妖巨大在线| 舔着乳尖日韩一区| 欧美美女激情18p| 香蕉影视欧美成人| 制服丝袜日韩国产| 三级不卡在线观看| 日韩免费性生活视频播放| 美女视频免费一区| 精品国产第一区二区三区观看体验| 久久99久久99| 久久尤物电影视频在线观看| 国产一区欧美一区| 国产亚洲精品aa| 日韩一区欧美一区| 欧美日韩国产小视频在线观看| 国产一区二区三区av电影| 国产亚洲欧美日韩俺去了| 国产成人av电影在线| 国产精品视频一区二区三区不卡| 成人涩涩免费视频| 国产精品国产自产拍高清av王其| 99精品久久免费看蜜臀剧情介绍| 1区2区3区欧美| 欧美视频在线一区| 免费人成精品欧美精品| 精品对白一区国产伦| 国产不卡视频一区| 伊人开心综合网| 欧美一区二区三区影视| 国精品**一区二区三区在线蜜桃| 欧美国产亚洲另类动漫| 日本福利一区二区| 日本成人在线一区| 欧美经典一区二区| 色综合久久综合网| 日韩电影免费在线看| 久久影院午夜论| 色哟哟一区二区在线观看| 日本中文在线一区| 国产欧美一区二区精品忘忧草| 色婷婷香蕉在线一区二区| 日韩电影免费在线看| 中文字幕精品一区| 欧美伦理影视网| 国产不卡视频一区二区三区| 伊人开心综合网| 精品国产精品网麻豆系列| 一本色道亚洲精品aⅴ| 日韩精品欧美成人高清一区二区| 国产清纯美女被跳蛋高潮一区二区久久w | 免费日本视频一区| 欧美国产综合色视频| 欧美日韩激情一区二区三区| 国产精品原创巨作av| 一区二区欧美在线观看| 久久综合九色综合欧美就去吻| 日本丰满少妇一区二区三区| 国产中文一区二区三区| 一区二区欧美精品| 日本一区二区三区久久久久久久久不 | 国产视频一区二区在线| 91久久精品一区二区二区| 日本不卡一区二区三区 | 一区二区三区在线观看国产| 日韩欧美一级在线播放| 91麻豆精品在线观看| 国产一区二区三区| 日韩专区欧美专区| 亚洲欧美激情小说另类| 久久影院午夜片一区| 5858s免费视频成人| 94-欧美-setu| 福利电影一区二区|