com.aelitis.azureus.core.networkmanager.impl
Class ProtocolDecoderPHE

java.lang.Object
  extended by com.aelitis.azureus.core.networkmanager.impl.ProtocolDecoder
      extended by com.aelitis.azureus.core.networkmanager.impl.ProtocolDecoderPHE

public class ProtocolDecoderPHE
extends ProtocolDecoder


Field Summary
static byte[] KEYA_IV
           
static byte[] KEYB_IV
           
static int MIN_INCOMING_INITIAL_PACKET_SIZE
           
static byte[] REQ1_IV
           
static byte[] REQ2_IV
           
static byte[] REQ3_IV
           
static byte[] VC
           
 
Constructor Summary
ProtocolDecoderPHE(TransportHelper _transport, byte[][] _shared_secrets, java.nio.ByteBuffer _header, java.nio.ByteBuffer _initial_data, ProtocolDecoderAdapter _adapter)
           
 
Method Summary
static void addSecretsSupport(byte[][] secrets)
           
protected  byte[] bigIntegerToBytes(java.math.BigInteger bi, int num_bytes)
           
protected  java.math.BigInteger bytesToBigInteger(byte[] bytes, int offset, int len)
           
protected  void complete()
           
protected  void completeDH(byte[] buffer)
           
protected  void failed(java.lang.Throwable cause)
           
protected static java.security.KeyPair generateDHKeyPair(TransportHelper transport, boolean outbound)
           
 TransportHelperFilter getFilter()
           
 long getLastReadTime()
           
static int getMaxIncomingInitialPacketSize(boolean min_overheads)
           
protected  int getPaddingMax()
           
protected static byte[] getRandomPadding(int max_len)
           
 java.lang.String getString()
           
protected static byte[] getZeroPadding(int max_len)
           
protected  void handshakeComplete()
           
protected  void initCrypto()
           
 boolean isComplete(long now)
           
static boolean isCryptoOK()
           
protected  void process()
           
protected  void read(java.nio.ByteBuffer buffer)
           
static void removeSecretsSupport(byte[][] secrets)
           
 void selectFailure(TransportHelper transport, java.lang.Object attachment, java.lang.Throwable msg)
           
 boolean selectSuccess(TransportHelper transport, java.lang.Object attachment, boolean write_operation)
           
protected  void setupCrypto()
           
protected  void write(java.nio.ByteBuffer buffer)
           
 
Methods inherited from class com.aelitis.azureus.core.networkmanager.impl.ProtocolDecoder
addSecrets, removeSecrets
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_INCOMING_INITIAL_PACKET_SIZE

public static final int MIN_INCOMING_INITIAL_PACKET_SIZE

KEYA_IV

public static final byte[] KEYA_IV

KEYB_IV

public static final byte[] KEYB_IV

REQ1_IV

public static final byte[] REQ1_IV

REQ2_IV

public static final byte[] REQ2_IV

REQ3_IV

public static final byte[] REQ3_IV

VC

public static final byte[] VC
Constructor Detail

ProtocolDecoderPHE

public ProtocolDecoderPHE(TransportHelper _transport,
                          byte[][] _shared_secrets,
                          java.nio.ByteBuffer _header,
                          java.nio.ByteBuffer _initial_data,
                          ProtocolDecoderAdapter _adapter)
                   throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getMaxIncomingInitialPacketSize

public static int getMaxIncomingInitialPacketSize(boolean min_overheads)

isCryptoOK

public static boolean isCryptoOK()

addSecretsSupport

public static void addSecretsSupport(byte[][] secrets)

removeSecretsSupport

public static void removeSecretsSupport(byte[][] secrets)

initCrypto

protected void initCrypto()
                   throws java.io.IOException
Throws:
java.io.IOException

completeDH

protected void completeDH(byte[] buffer)
                   throws java.io.IOException
Throws:
java.io.IOException

setupCrypto

protected void setupCrypto()
                    throws java.io.IOException
Throws:
java.io.IOException

handshakeComplete

protected void handshakeComplete()
                          throws java.io.IOException
Throws:
java.io.IOException

process

protected void process()
                throws java.io.IOException
Throws:
java.io.IOException

read

protected void read(java.nio.ByteBuffer buffer)
             throws java.io.IOException
Throws:
java.io.IOException

write

protected void write(java.nio.ByteBuffer buffer)
              throws java.io.IOException
Throws:
java.io.IOException

selectSuccess

public boolean selectSuccess(TransportHelper transport,
                             java.lang.Object attachment,
                             boolean write_operation)

selectFailure

public void selectFailure(TransportHelper transport,
                          java.lang.Object attachment,
                          java.lang.Throwable msg)

bigIntegerToBytes

protected byte[] bigIntegerToBytes(java.math.BigInteger bi,
                                   int num_bytes)

bytesToBigInteger

protected java.math.BigInteger bytesToBigInteger(byte[] bytes,
                                                 int offset,
                                                 int len)

getPaddingMax

protected int getPaddingMax()

getRandomPadding

protected static byte[] getRandomPadding(int max_len)

getZeroPadding

protected static byte[] getZeroPadding(int max_len)

generateDHKeyPair

protected static java.security.KeyPair generateDHKeyPair(TransportHelper transport,
                                                         boolean outbound)
                                                  throws java.io.IOException
Throws:
java.io.IOException

complete

protected void complete()

failed

protected void failed(java.lang.Throwable cause)

isComplete

public boolean isComplete(long now)
Specified by:
isComplete in class ProtocolDecoder

getFilter

public TransportHelperFilter getFilter()
Specified by:
getFilter in class ProtocolDecoder

getLastReadTime

public long getLastReadTime()

getString

public java.lang.String getString()