Class ProtocolDecoderPHE

java.lang.Object
com.biglybt.core.networkmanager.impl.ProtocolDecoder
com.biglybt.core.networkmanager.impl.ProtocolDecoderPHE

public class ProtocolDecoderPHE extends ProtocolDecoder
  • Field Details

    • LOGID

      private static final LogIDs LOGID
    • CRYPTO_PLAIN

      private static final byte CRYPTO_PLAIN
      See Also:
    • CRYPTO_RC4

      private static final byte CRYPTO_RC4
      See Also:
    • CRYPTO_XOR

      private static final byte CRYPTO_XOR
      See Also:
    • CRYPTO_AES

      private static final byte CRYPTO_AES
      See Also:
    • DH_P

      private static final String DH_P
      See Also:
    • DH_G

      private static final String DH_G
      See Also:
    • DH_L

      private static final int DH_L
      See Also:
    • DH_SIZE_BYTES

      private static final int DH_SIZE_BYTES
    • MIN_INCOMING_INITIAL_PACKET_SIZE

      public static final int MIN_INCOMING_INITIAL_PACKET_SIZE
    • DH_P_BI

      private static final BigInteger DH_P_BI
    • DH_G_BI

      private static final BigInteger DH_G_BI
    • dh_key_generator

      private static KeyPairGenerator dh_key_generator
    • BLOOM_RECREATE

      private static final int BLOOM_RECREATE
      See Also:
    • BLOOM_INCREASE

      private static final int BLOOM_INCREASE
      See Also:
    • generate_bloom

      private static BloomFilter generate_bloom
    • generate_bloom_create_time

      private static long generate_bloom_create_time
    • crypto_setup_done

      private static boolean crypto_setup_done
    • crypto_ok

      private static boolean crypto_ok
    • RC4_STREAM_ALG

      private static final String RC4_STREAM_ALG
      See Also:
    • RC4_STREAM_CIPHER

      private static final String RC4_STREAM_CIPHER
      See Also:
    • RC4_STREAM_KEY_SIZE

      private static final int RC4_STREAM_KEY_SIZE
      See Also:
    • RC4_STREAM_KEY_SIZE_BYTES

      private static final int RC4_STREAM_KEY_SIZE_BYTES
      See Also:
    • PADDING_MAX

      private static final int PADDING_MAX
      See Also:
    • PADDING_MAX_NORMAL

      private static final int PADDING_MAX_NORMAL
      See Also:
    • PADDING_MAX_LIMITED

      private static final int PADDING_MAX_LIMITED
      See Also:
    • random

      private static final Random random
    • global_shared_secrets

      private static final Map<HashWrapper,Object[]> global_shared_secrets
    • MAX_OLD_SECRETS

      private static final int MAX_OLD_SECRETS
      See Also:
    • old_global_shared_secrets

      private static final Map<HashWrapper,Object[]> old_global_shared_secrets
    • SUPPORTED_PROTOCOLS

      private static final byte SUPPORTED_PROTOCOLS
      See Also:
    • MIN_CRYPTO

      static byte MIN_CRYPTO
    • PS_OUTBOUND_1

      private static final int PS_OUTBOUND_1
      See Also:
    • PS_OUTBOUND_2

      private static final int PS_OUTBOUND_2
      See Also:
    • PS_OUTBOUND_3

      private static final int PS_OUTBOUND_3
      See Also:
    • PS_OUTBOUND_4

      private static final int PS_OUTBOUND_4
      See Also:
    • PS_INBOUND_1

      private static final int PS_INBOUND_1
      See Also:
    • PS_INBOUND_2

      private static final int PS_INBOUND_2
      See Also:
    • PS_INBOUND_3

      private static final int PS_INBOUND_3
      See Also:
    • PS_INBOUND_4

      private static final int PS_INBOUND_4
      See Also:
    • 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
    • transport

      private TransportHelper transport
    • write_buffer

      private ByteBuffer write_buffer
    • read_buffer

      private ByteBuffer read_buffer
    • adapter

      private ProtocolDecoderAdapter adapter
    • key_agreement

      private KeyAgreement key_agreement
    • dh_public_key_bytes

      private byte[] dh_public_key_bytes
    • shared_secret

      private byte[] shared_secret
    • secret_bytes

      private byte[] secret_bytes
    • initial_data_out

      private ByteBuffer initial_data_out
    • initial_data_in

      private ByteBuffer initial_data_in
    • write_cipher

      private TransportCipher write_cipher
    • read_cipher

      private TransportCipher read_cipher
    • padding_skip_marker

      private byte[] padding_skip_marker
    • my_supported_protocols

      private byte my_supported_protocols
    • selected_protocol

      private byte selected_protocol
    • outbound

      private boolean outbound
    • protocol_state

      private int protocol_state
    • protocol_substate

      private int protocol_substate
    • handshake_complete

      private boolean handshake_complete
    • bytes_read

      private int bytes_read
    • bytes_written

      private int bytes_written
    • last_read_time

      private long last_read_time
    • filter

      private TransportHelperFilter filter
    • delay_outbound_4

      private boolean delay_outbound_4
    • processing_complete

      private boolean processing_complete
    • process_mon

      private final AEMonitor process_mon
  • Constructor Details

  • Method Details

    • getMaxIncomingInitialPacketSize

      public static int getMaxIncomingInitialPacketSize(boolean min_overheads)
    • cryptoSetup

      private static boolean cryptoSetup()
    • isCryptoOK

      public static boolean isCryptoOK()
    • addSecretsSupport

      public static void addSecretsSupport(String name, byte[][] secrets)
    • removeSecretsSupport

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

      protected void initCrypto() throws IOException
      Throws:
      IOException
    • completeDH

      protected void completeDH(byte[] buffer) throws IOException
      Throws:
      IOException
    • setupCrypto

      protected void setupCrypto() throws IOException
      Throws:
      IOException
    • handshakeComplete

      protected void handshakeComplete() throws IOException
      Throws:
      IOException
    • process

      protected void process() throws IOException
      Throws:
      IOException
    • read

      protected void read(ByteBuffer buffer) throws IOException
      Throws:
      IOException
    • write

      protected void write(ByteBuffer buffer) throws IOException
      Throws:
      IOException
    • selectSuccess

      public boolean selectSuccess(TransportHelper transport, Object attachment, boolean write_operation)
    • selectFailure

      public void selectFailure(TransportHelper transport, Object attachment, Throwable msg)
    • bigIntegerToBytes

      protected byte[] bigIntegerToBytes(BigInteger bi, int num_bytes)
    • bytesToBigInteger

      protected 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 KeyPair generateDHKeyPair(TransportHelper transport, boolean outbound) throws IOException
      Throws:
      IOException
    • complete

      protected void complete()
    • failed

      protected void failed(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 String getString()