# KeyExchange (sshj 0.5.0 API)
Date: 2011-07-27

## net.schmizz.sshj.transport.kex
Interface KeyExchange

All Known Implementing Classes:
  AbstractDHG, DHG1, DHG14

    public interface KeyExchange

Key exchange algorithm.

Method Summary
`byte[]` `getH()`
`Digest` `getHash()` The message digest used by this key exchange algorithm.
`PublicKey` `getHostKey()`
`BigInteger` `getK()`
`void` `init(Transport trans, String V_S, String V_C, byte[] I_S, byte[] I_C)` Initialize the key exchange algorithm.
`boolean` `next(Message msg, SSHPacket buffer)` Process the next packet

Method Detail

### init

    void init(Transport trans,
              String V_S,
              String V_C,
              byte[] I_S,
              byte[] I_C)
              throws GeneralSecurityException,
                     TransportException

  Initialize the key exchange algorithm.

  Parameters:
    `trans` - the transport
    `V_S` - the server identification string
    `V_C` - the client identification string
    `I_S` - the server key init packet
    `I_C` - the client key init packet
  Throws:
    `GeneralSecurityException`
    `TransportException` - if there is an error sending a packet

### getH

    byte[] getH()

  Returns:
    the computed H parameter

### getK

    BigInteger getK()

  Returns:
    the computed K parameter

### getHash

    Digest getHash()

  The message digest used by this key exchange algorithm.

  Returns:
    the message digest

### getHostKey

    PublicKey getHostKey()

  Returns:
    the host key determined from server's response packets

### next

    boolean next(Message msg,
                 SSHPacket buffer)
                 throws GeneralSecurityException,
                        TransportException

  Process the next packet

  Parameters:
    `msg` - message identifier
    `buffer` - the packet
  Returns:
    a boolean indicating if the processing is complete or if more packets are to be received
  Throws:
    `GeneralSecurityException`
    `TransportException` - if there is an error sending a packet

Copyright © 2009-2011. All Rights Reserved.