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

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

?? atlspacketreader.java

?? ATLS原代碼庫,實現的很不錯 ATLS原代碼庫,實現的很不錯
?? JAVA
字號:
/* * Copyright (c) 2002 by The Regents of the University of California.  * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement is * hereby granted, provided that the above copyright notice and the following * two paragraphs appear in all copies of this software. * * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. * * Author: Dennis Chi <denchi@uclink4.berkeley.edu>  * */package seda.sandStorm.lib.aTLS;import seda.sandStorm.lib.aTLS.protocol.*;import COM.claymoresystems.ptls.*;import seda.sandStorm.api.*;import seda.sandStorm.lib.aSocket.*;import seda.sandStorm.core.*;import seda.sandStorm.main.*;import seda.sandStorm.lib.util.*;import java.util.*;import java.io.*;import java.net.*;/** * An aTLSPacketReader is associated with each aTLSConnection to help order the * ATcpInPackets and to group packets into entire records if a record happens * to be broken up into multiple packets. Also handles multiple records in * one packet. */class aTLSPacketReader implements aTLSConst{    private static final boolean DEBUG = false;    private static final boolean DEBUGBYTES = false;    // need_length indicates not enough data to read the length    // need_data indicates that the length of the data is known, but    // that amount of data has not been received.    static final int NEED_LENGTH = 1;    static final int NEED_DATA = 2;    static final int NO_DATA = 0;    int amountNeeded;    int state;            // MULTITHREADING CHANGE!    aSocketInputStream asis;        // this is the record header information that is necessary    SSLuint8 type;    SSLuint16 version;    SSLopaque data;    aTLSConnection atlsconn;    // this is for sslv2 stuff    byte[] checkByte = new byte[2];    boolean sslv2 = false;    SSLuint16 sslv2_len = new SSLuint16();       public aTLSPacketReader (aTLSConnection atlsconn) {	this.atlsconn = atlsconn;	asis = new aSocketInputStream();	reset();    }    public void reset() {	amountNeeded = 0;	state = NO_DATA;	checkByte[0] = -1;    }    /**     * This function will return a linkedList consisting of all the records that are in the     * aSocketInputStream. Need a linkedlist because there could be multiple records in one packet.     * Every record (except SSLv2 client hellos) has 5 bytes at the beginning:     * 1st byte indicates the record type: application data, handshake, change cipher spec, alert.     * 2nd & 3rd bytes indicate the protocol version: SSL, TLS, etc...     * 4th & 5th bytes indicate the length of the data.     * For SSLv2 client hello, need to read the first 2 bytes to get the length of the message.     *     * No need to decode the record header until there are at least 5 bytes read in initially.     * Once those 5 bytes have been read, create an aTLSRecord, decode the header to get the      * information, then wait for all that data to come in.     *     * Assuming that two completely different messages will not exist on the same ATcpInPacket     * So if I need 60 bytes, and it was broken up into 9, 9, 9, 9, 9, 9, and the last packet     * only needed 4 bytes, another packet wouldn't add on to that 4 bytes.     */    public LinkedList readPacket() throws java.io.IOException {	LinkedList recordHolder = new LinkedList();	boolean leave = false;	if (DEBUG) System.err.println ("aTLSPacketReader: This is how much is in the asis stream now: " + asis.available());	// while loop is necessary b/c need to keep looping through the data if there are multiple records in one packet	while (asis.available() > 0) {	    switch (state) {	    case NO_DATA:		// the only purpose for this is for the SSLv2ClientHello		// need to read the first byte to see if it matches an SSLv2 client hello, or just garbage		if ((atlsconn.isServer) && (atlsconn.conn.hs.state == SSL_HS_WAIT_FOR_CLIENT_HELLO)) {		    asis.read(checkByte, 0 , 1);		    if (DEBUG) System.err.println ("aTLSPacketReader: this is what the first byte is: " + checkByte[0]);		    if (checkByte[0] != 0x16) {			if (DEBUG) System.err.println ("aTLSPacketReader: detected an SSLV2 message");			sslv2 = true;		    }		    // else, it is a normal client hello, so drop down to next case		}	    case NEED_LENGTH:		if (sslv2) {		    // Need at least 2 bytes to read the length off of an sslv2		    // remember, already read one byte, so only need to check if there's another		    if (asis.available() >= 1) {			if (DEBUG) System.err.println ("aTLSPacketReader: enough of the packet to read the length");			asis.read (checkByte, 1, 1);			try {			    // there is no recordHeader for an SSLv2 client hello, so no need to call read record headeer.			    sslv2_len.decode(atlsconn.conn, new ByteArrayInputStream (checkByte)); // Assume 2-byte header form 			}			catch (IOException e) {			    // IMPORTANT:			    // this short read should occur because sslv2_len.decode will decode the length, then decode the actual			    // data, but since only supplied two bytes to get the length, a short read will occur.			    if (DEBUG) System.err.println ("aTLSPacketReader: This short read is expected for SSLv2, read comments.");			}			amountNeeded = sslv2_len.value & 0x7fff;			if (DEBUG) System.err.println ("aTLsPacketReader: will need this much for sslv2: " + amountNeeded);			// this will drop down to the next case, because enough to read header now.		    }		    else {			leave = true;			state = NEED_LENGTH;			break;		    }		}		else {		    // need at least 5 bytes to read off the correct information for a non sslv2 handshake message		    if (asis.available() >= 5) {			if (DEBUG) System.err.println ("aTLSPacketReader: Enough data to read record length. " + 						       "This is how much that is available: " + asis.available());			readRecordHeader();			// this will drop down to the next case, because there is no break;		    }		    else {			if (DEBUG) System.err.println ("aTLSPacketReader: Not enough data to read record length. " + 						   " This is how much that is available: " + asis.available() + "\n\n\n");			// this boolean is necessary b/c this is the only way to break out of the while loop, even though			// there is some data available because we want to exit to wait for another packet with more info.			leave = true;			state = NEED_LENGTH;			break;		    }		}	    case NEED_DATA:		if (asis.available() < amountNeeded) {		    // so not enough data yet		    if (DEBUG) System.err.println ("aTLSPacketReader: All the data has not been received yet.");		    if (DEBUG) System.err.println ("Need to read this much: " + amountNeeded + 						   ", but only have this much: " + asis.available());		    state = NEED_DATA;		    // need to set this because need to break out of the while loop		    leave = true;		}		else {		    if (DEBUG) System.err.println ("aTLSPacketReader: All data has been received, about to start reading this much: " 						   + asis.available());		    // all the necessary data has been received, so can read all of it now		    byte[] needed;		    int temp;		    aTLSRecord record;		    if (sslv2) {			needed = new byte [amountNeeded + 2];			temp = asis.read (needed, 2, amountNeeded);			if (temp != amountNeeded) {			    System.err.println ("aTLSPacketReader: didn't read enough, something wrong here. Error, contact mdw@cs.berkeley.edu");			}			needed[0] = checkByte[0];			needed[1] = checkByte[1];			record = new aTLSHandshakeRecord (needed, true);		    }		    else {			needed = new byte [amountNeeded];			temp = asis.read (needed);			if (temp != amountNeeded) {			    System.err.println ("aTLSPacketReader: didn't read enough, something wrong here. Error, contact mdw@cs.berkeley.edu");			}		    						data.value = needed;						// need to call createRecord to "encode" the first 5 bytes back onto the record.			record = createRecord();		    }		    		    sslv2 = false;		    		    // just add the record to the Linked list, and loop again if there is more info		    recordHolder.add (record);		    // since one record was read, we want to see if we should read another, so we keep the 		    // stream intact, but we reset the state		    state = NO_DATA;		    amountNeeded = 0;		}			break;	    default:		System.err.println ("aTLSPacketReader: Bad state. Error, contact mdw@cs.berkeley.edu");	    }	    if (leave == true) {		break;	    }	}	// will return null if not all the data was received	// otherwise, would have been returned within else of NEED_DATA case above	if (asis.available() == 0) {	    //System.err.println ("ATLSPACKETREADER: RESETTING EVERYTHING");	    // the only time to reset is if all the information has been read	    reset();	}	return recordHolder;    }       /**     * This function will be called when there is at least 5 bytes of data, meaning that      * there is enough data to read the record header information.      * Will create an aTLSRecord and call decodeHeader() to get the necessary     * information to continue.     * NOTE: not technically "decoding" the record, because the first 5 bytes are not     * encrypted.     */    void readRecordHeader() throws java.io.IOException {	if (DEBUG) System.err.println ("aTLSPacketReader: Inside readRecordHeader()");	// need to reinitialize these, b/c readRecordHeader could be called for multiple records, and the	// length information gets altered when the decoding takes place	type = new SSLuint8();	version = new SSLuint16();	data = new SSLopaque(-65535);	byte[] header = new byte[5];	int temp;	// this will read in the 5 bytes needed from the record header	if (checkByte[0] != -1) {	    // this is necessary because if not a sslv2 client hello, but it is a client hello message, then	    // already read one byte off, so have to keep track of that byte.	    header[0] = checkByte[0];	    temp = asis.read(header, 1, 4);	    if (temp != 4) {		System.err.println ("aTLSPacketReader0: Error, didn't read enough in readRecordHeader(). Contact mdw@cs.berkeley.edu");		System.err.println ("Ended up reading this much: " + temp + " when I needed 4");	    }	}	else {	    temp = asis.read (header);	    if (temp != 5) {		System.err.println ("aTLSPacketReader1: Error, didn't read enough in readRecordHeader(). Contact mdw@cs.berkeley.edu");		System.err.println ("Ended up reading this much: " + temp + " when I needed 5");	    }	}		if (DEBUG) System.err.println ("aTLSPacketReader: This is what the record header looks like ");	if (DEBUG) {	    for (int m = 0; m < 5; m++) {		System.err.print (header[m] + " ");	    }	}	if (DEBUG) System.err.println ();	if (DEBUG) System.err.println ("aTLSPacketReader: Just read off the header, this is how much is available: " + asis.available());		ByteArrayInputStream bais = new ByteArrayInputStream (header);	type.decode(atlsconn.conn, bais);	version.decode(atlsconn.conn, bais);	try {	    data.decode(atlsconn.conn, bais);	}	catch (IOException e) {	    // IMPORTANT: 	    // this will throw an exception, because when we decode the data, all we want is the length,	    // but data.decode will try to decode all of the data. But since we only call decode with two	    // bytes in the stream, a short read will always happen, BUT THAT'S EXPECTED	    if (DEBUG) System.err.println ("aTLSPacketReader: this IO problem for short read is expected, read comments.");	}	amountNeeded = data.value.length;	if (DEBUG) System.err.println ("aTLSPacketReader: Will have to read this much to get the whole record: " + amountNeeded);    }        /**     * Returns the appropriate aTLSRecord type (change cipher spec, alert, handshake, application data) after     * "reencoding" the first few bytes.     */    aTLSRecord createRecord() {	ByteArrayOutputStream baos = new ByteArrayOutputStream();		try {	    type.encode (atlsconn.conn, baos);	    version.encode (atlsconn.conn, baos);	    data.encode (atlsconn.conn, baos);	}	catch (Exception e) {	    System.err.println ("aTLSPacketReader: Exception trying to re-encode the record: " + e + 				" Internal Error, contact mdw@cs.berkeley.edu");	}	if (DEBUGBYTES) {	    System.err.println ("aTLSPacketReader: this is the data after encoded again.");	    byte[] x = baos.toByteArray();	    for (int i = 0; i < x.length; i++) {		System.err.print (x[i] + " ");	    }	    System.err.println ();	}		switch (type.value) {	case SSL_CT_CHANGE_CIPHER_SPEC:	    return (new aTLSCipherSpecRecord(baos.toByteArray()));	case SSL_CT_ALERT:	    return (new aTLSAlertRecord(baos.toByteArray()));	case SSL_CT_HANDSHAKE:	    return (new aTLSHandshakeRecord(baos.toByteArray()));	case SSL_CT_APPLICATION_DATA:	    return (new aTLSAppDataRecord(baos.toByteArray(), data.value.length));	default:	    System.err.println ("aTLSPacketReader: Not a valid record type: " + type.value + " Internal Error, contact mdw@cs.berkeley.edu");	    return null;	}    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
玉米视频成人免费看| 国产精品免费aⅴ片在线观看| 精品国产精品一区二区夜夜嗨| 欧美日韩一区二区不卡| 99久久精品一区| 毛片av一区二区| 久久精品国产99久久6| 一区二区三区在线观看动漫| 亚洲女爱视频在线| 日韩二区在线观看| 国产一区亚洲一区| 色综合一个色综合亚洲| 欧美最猛黑人xxxxx猛交| 日韩欧美在线一区二区三区| 国产精品另类一区| 午夜激情一区二区| 9i在线看片成人免费| 777xxx欧美| 亚洲一区在线观看免费 | 精品国产乱码久久久久久免费 | 丝袜诱惑制服诱惑色一区在线观看 | 午夜精品福利视频网站| 成人激情黄色小说| 欧美精品18+| 亚洲男人电影天堂| 国内精品伊人久久久久影院对白| proumb性欧美在线观看| 日韩欧美国产电影| 亚洲在线免费播放| www.性欧美| 久久久噜噜噜久久中文字幕色伊伊 | 色八戒一区二区三区| 国产精品国产三级国产a| 久久国产精品免费| 91精品国产免费久久综合| 亚洲激情五月婷婷| av在线不卡观看免费观看| 国产亚洲人成网站| 国产成人无遮挡在线视频| 久久久夜色精品亚洲| 国产主播一区二区三区| 久久九九久久九九| 国产一区二区三区四| 日本一区二区动态图| 国产麻豆视频精品| 精品粉嫩aⅴ一区二区三区四区| 秋霞av亚洲一区二区三| 精品国产3级a| 久久se这里有精品| 中文字幕av不卡| 不卡大黄网站免费看| 亚洲最新视频在线播放| 欧美高清一级片在线| 青青草一区二区三区| 欧美国产乱子伦| 欧美日韩国产美女| 国产福利一区在线| 亚洲妇女屁股眼交7| 欧美变态tickle挠乳网站| 国产一区二区三区| 国产在线乱码一区二区三区| 日本一区二区免费在线| 欧美日韩一区 二区 三区 久久精品| 日本欧美在线观看| 精品区一区二区| 欧美日韩在线播| aa级大片欧美| 国产盗摄女厕一区二区三区| 亚洲第一会所有码转帖| 日韩美一区二区三区| 欧美人妇做爰xxxⅹ性高电影| 成人综合在线观看| 国产一区 二区 三区一级| 亚洲国产综合在线| 亚洲免费观看高清| 精品盗摄一区二区三区| 7777精品伊人久久久大香线蕉完整版 | 日本欧美一区二区三区| 亚洲日本丝袜连裤袜办公室| 国产亚洲1区2区3区| 宅男在线国产精品| 欧美日韩在线播放| 色婷婷久久综合| 91亚洲精品一区二区乱码| 风间由美中文字幕在线看视频国产欧美 | 麻豆精品一区二区三区| 一区二区三区鲁丝不卡| 亚洲少妇屁股交4| 亚洲免费观看在线视频| 亚洲乱码国产乱码精品精的特点| 欧美优质美女网站| 色伊人久久综合中文字幕| 国产精品12区| 99亚偷拍自图区亚洲| 在线免费不卡电影| 欧美一级高清大全免费观看| 欧美日韩中文精品| 91精品国产欧美一区二区18| 久久亚洲影视婷婷| 最新国产精品久久精品| 日韩精品欧美成人高清一区二区| 麻豆国产一区二区| av电影天堂一区二区在线| 欧美日韩国产成人在线91| 国产午夜精品一区二区| 亚洲综合在线第一页| 九一九一国产精品| 99re这里只有精品视频首页| 日韩免费看网站| 久久久久国产精品麻豆| 最新中文字幕一区二区三区| 蜜臀av一区二区在线观看| gogogo免费视频观看亚洲一| 91精品国产免费| 国产亚洲va综合人人澡精品| 另类成人小视频在线| 欧美午夜精品理论片a级按摩| 精品久久久久久久久久久院品网| 亚洲精品亚洲人成人网 | 精品国产乱码久久久久久老虎| 欧美美女bb生活片| 香港成人在线视频| 91美女片黄在线| 亚洲人成网站色在线观看| 国产一区二区视频在线| 欧美揉bbbbb揉bbbbb| 亚洲国产精品久久久久秋霞影院| 国产91精品露脸国语对白| 久久久精品国产免费观看同学| 另类中文字幕网| 91麻豆精品国产自产在线| 日本中文字幕一区二区视频| 欧美午夜一区二区三区免费大片| 亚洲女性喷水在线观看一区| 99久久国产综合精品色伊| 精品美女一区二区| www.欧美精品一二区| 一区二区三区在线视频观看 | 久久先锋影音av| 蜜乳av一区二区| 国产精品嫩草影院com| 成人91在线观看| 亚洲综合在线免费观看| 欧美午夜在线观看| 亚洲伦理在线精品| 欧美精品一区二区三区很污很色的| 免费成人在线影院| 国产精品视频一区二区三区不卡| 国产凹凸在线观看一区二区| 国产三级精品在线| 欧美伊人精品成人久久综合97| 日韩制服丝袜av| 国产精品传媒入口麻豆| 欧美日韩黄视频| 91老师片黄在线观看| 久久精品久久99精品久久| 亚洲特黄一级片| 精品国产99国产精品| 91精品国产一区二区三区蜜臀| 国产一区二区在线电影| 亚洲精品少妇30p| 欧美精品一区二区三区高清aⅴ| 99久久精品99国产精品| 高清在线成人网| 精品一区二区精品| 视频一区视频二区中文| 亚洲人亚洲人成电影网站色| 中文字幕不卡三区| 久久久亚洲精品一区二区三区| 欧美日韩在线播放一区| 91蝌蚪porny九色| 日本韩国视频一区二区| 色哟哟欧美精品| 国产最新精品免费| 国产在线国偷精品免费看| 日韩1区2区3区| 亚洲自拍偷拍av| 国产精品久久精品日日| 日韩欧美久久一区| 欧美r级在线观看| www国产成人免费观看视频 深夜成人网| 欧美视频在线观看一区| 欧美日韩亚洲不卡| 在线不卡中文字幕播放| 91精品国产手机| www激情久久| 亚洲gay无套男同| 毛片av一区二区| 国产精品99久久久| bt7086福利一区国产| 欧美日韩一区二区三区在线看| 欧美一区欧美二区| 国产日产精品1区| 亚洲一区在线电影| 成人免费精品视频| 欧美丝袜自拍制服另类| 26uuu精品一区二区| www久久精品| 老司机免费视频一区二区| 91丨porny丨户外露出|