Class KexManager

  • All Implemented Interfaces:
    MessageHandler

    public class KexManager
    extends java.lang.Object
    implements MessageHandler
    KexManager.
    Version:
    $Id: KexManager.java,v 1.1 2007/10/15 12:49:56 cplattne Exp $
    • Field Detail

      • log

        private static final Logger log
      • DEFAULT_KEY_ALGORITHMS

        private static final java.util.List<java.lang.String> DEFAULT_KEY_ALGORITHMS
      • kexCount

        int kexCount
      • sessionId

        byte[] sessionId
      • accessLock

        final java.lang.Object accessLock
      • connectionClosed

        boolean connectionClosed
      • ignore_next_kex_packet

        boolean ignore_next_kex_packet
      • hostname

        final java.lang.String hostname
      • port

        final int port
      • rnd

        final java.security.SecureRandom rnd
    • Method Detail

      • getOrWaitForConnectionInfo

        public ConnectionInfo getOrWaitForConnectionInfo​(int minKexCount)
                                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • compareFirstOfNameList

        private boolean compareFirstOfNameList​(java.lang.String[] a,
                                               java.lang.String[] b)
      • establishKeyMaterial

        private boolean establishKeyMaterial()
      • finishKex

        private void finishKex()
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • getDefaultServerHostkeyAlgorithmList

        public static java.lang.String[] getDefaultServerHostkeyAlgorithmList()
      • buildDefaultKeyAlgorithms

        private static java.util.List<java.lang.String> buildDefaultKeyAlgorithms()
      • checkServerHostkeyAlgorithmsList

        public static void checkServerHostkeyAlgorithmsList​(java.lang.String[] algos)
      • getDefaultKexAlgorithmList

        public static java.lang.String[] getDefaultKexAlgorithmList()
      • checkKexAlgorithmList

        public static void checkKexAlgorithmList​(java.lang.String[] algos)
      • verifySignature

        private boolean verifySignature​(byte[] sig,
                                        byte[] hostkey)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • handleMessage

        public void handleMessage​(byte[] msg,
                                  int msglen)
                           throws java.io.IOException
        Description copied from interface: MessageHandler
        Handle message.
        Specified by:
        handleMessage in interface MessageHandler
        Parameters:
        msg - the msg
        msglen - the msglen
        Throws:
        java.io.IOException - the io exception
      • handleEndMessage

        public void handleEndMessage​(java.lang.Throwable cause)
                              throws java.io.IOException
        Description copied from interface: MessageHandler
        Called to inform that no more messages will be delivered.
        Specified by:
        handleEndMessage in interface MessageHandler
        Parameters:
        cause - For diagnosis, the reason that caused the transport to close down.
        Throws:
        java.io.IOException - the io exception