PcapPlusPlus  22.11
pcpp::SSHKeyExchangeInitMessage Class Reference

#include <SSHLayer.h>

Inheritance diagram for pcpp::SSHKeyExchangeInitMessage:
pcpp::SSHHandshakeMessage pcpp::SSHLayer pcpp::Layer pcpp::IDataContainer

Public Member Functions

 SSHKeyExchangeInitMessage (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
uint8_t * getCookie ()
 
std::string getCookieAsHexStream ()
 
std::string getKeyExchangeAlgorithms ()
 
std::string getServerHostKeyAlgorithms ()
 
std::string getEncryptionAlgorithmsClientToServer ()
 
std::string getEncryptionAlgorithmsServerToClient ()
 
std::string getMacAlgorithmsClientToServer ()
 
std::string getMacAlgorithmsServerToClient ()
 
std::string getCompressionAlgorithmsClientToServer ()
 
std::string getCompressionAlgorithmsServerToClient ()
 
std::string getLanguagesClientToServer ()
 
std::string getLanguagesServerToClient ()
 
bool isFirstKexPacketFollows ()
 
- Public Member Functions inherited from pcpp::SSHHandshakeMessage
SSHHandshakeMessageType getMessageType () const
 
std::string getMessageTypeStr () const
 
uint8_t * getSSHHandshakeMessage () const
 
size_t getSSHHandshakeMessageLength () const
 
size_t getPaddingLength () const
 
size_t getHeaderLen () const
 
std::string toString () const
 
- Public Member Functions inherited from pcpp::SSHLayer
void parseNextLayer ()
 
void computeCalculateFields ()
 
OsiModelLayer getOsiModelLayer () const
 
- Public Member Functions inherited from pcpp::Layer
virtual ~Layer ()
 
LayergetNextLayer () const
 
LayergetPrevLayer () const
 
ProtocolType getProtocol () const
 
uint8_t * getData () const
 
size_t getDataLen () const
 
uint8_t * getLayerPayload () const
 
size_t getLayerPayloadSize () const
 
bool isAllocatedToPacket () const
 
void copyData (uint8_t *toArr) const
 
uint8_t * getDataPtr (size_t offset=0) const
 

Additional Inherited Members

- Public Types inherited from pcpp::SSHHandshakeMessage
enum  SSHHandshakeMessageType {
  SSH_MSG_KEX_INIT = 20, SSH_MSG_NEW_KEYS = 21, SSH_MSG_KEX_DH_INIT = 30, SSH_MSG_KEX_DH_REPLY = 31,
  SSH_MSG_KEX_DH_GEX_INIT = 32, SSH_MSG_KEX_DH_GEX_REPLY = 33, SSH_MSG_KEX_DH_GEX_REQUEST = 34, SSH_MSG_UNKNOWN = 999
}
 
- Static Public Member Functions inherited from pcpp::SSHHandshakeMessage
static SSHHandshakeMessagetryParse (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
- Static Public Member Functions inherited from pcpp::SSHLayer
static SSHLayercreateSSHMessage (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
static bool isSSHPort (uint16_t portSrc, uint16_t portDst)
 

Detailed Description

A class representing the SSH Key Exchange Init message. This is a non-encrypted message that contains information about the algorithms used for key exchange, encryption, MAC and compression. This class provides methods to access these details

Constructor & Destructor Documentation

◆ SSHKeyExchangeInitMessage()

pcpp::SSHKeyExchangeInitMessage::SSHKeyExchangeInitMessage ( uint8_t *  data,
size_t  dataLen,
Layer prevLayer,
Packet packet 
)

A c'tor for this class that accepts raw message data. Please avoid using it as it's used internally when parsing SSH handshake messages in SSHHandshakeMessage::tryParse()

Parameters
[in]dataA pointer to the raw data
[in]dataLenSize of the data in bytes
[in]prevLayerA pointer to the previous layer
[in]packetA pointer to the Packet instance where layer will be stored in

Member Function Documentation

◆ getCompressionAlgorithmsClientToServer()

std::string pcpp::SSHKeyExchangeInitMessage::getCompressionAlgorithmsClientToServer ( )
inline
Returns
A comma-separated list of acceptable compression algorithms from the client to the server. Can be empty if the value is missing or the message is malformed

◆ getCompressionAlgorithmsServerToClient()

std::string pcpp::SSHKeyExchangeInitMessage::getCompressionAlgorithmsServerToClient ( )
inline
Returns
A comma-separated list of acceptable compression algorithms from the server to the client. Can be empty if the value is missing or the message is malformed

◆ getCookie()

uint8_t* pcpp::SSHKeyExchangeInitMessage::getCookie ( )

Each SSH Key Exchange Init message contains a random 16-byte value generated by the sender. This method returns a pointer to this 16-byte cookie. To get the value as a hex string please refer to getCookieAsHexStream()

Returns
A pointer to the 16-byte cookie value or NULL if the message is malformed

◆ getCookieAsHexStream()

std::string pcpp::SSHKeyExchangeInitMessage::getCookieAsHexStream ( )

Each SSH Key Exchange Init message contains a random 16-byte value generated by the sender. This method returns the 16-byte cookie as a hex stream. To get the raw data please refer to getCookie()

Returns
A hex stream of the 16-byte cookie value or an empty string if the message is malformed

◆ getEncryptionAlgorithmsClientToServer()

std::string pcpp::SSHKeyExchangeInitMessage::getEncryptionAlgorithmsClientToServer ( )
inline
Returns
A comma-separated list of acceptable symmetric encryption algorithms (also known as ciphers) from the client to the server. Can be empty if the value is missing or the message is malformed

◆ getEncryptionAlgorithmsServerToClient()

std::string pcpp::SSHKeyExchangeInitMessage::getEncryptionAlgorithmsServerToClient ( )
inline
Returns
A comma-separated list of acceptable symmetric encryption algorithms (also known as ciphers) from the server to the client. Can be empty if the value is missing or the message is malformed

◆ getKeyExchangeAlgorithms()

std::string pcpp::SSHKeyExchangeInitMessage::getKeyExchangeAlgorithms ( )
inline
Returns
A comma-separated list of the key exchange algorithms used in this session. Can be empty if the value is missing or the message is malformed

◆ getLanguagesClientToServer()

std::string pcpp::SSHKeyExchangeInitMessage::getLanguagesClientToServer ( )
inline
Returns
A comma-separated list of language tags from the client to the server. Can be empty if the value is missing or the message is malformed

◆ getLanguagesServerToClient()

std::string pcpp::SSHKeyExchangeInitMessage::getLanguagesServerToClient ( )
inline
Returns
A comma-separated list of language tags from the server to the client. Can be empty if the value is missing or the message is malformed

◆ getMacAlgorithmsClientToServer()

std::string pcpp::SSHKeyExchangeInitMessage::getMacAlgorithmsClientToServer ( )
inline
Returns
A comma-separated list of acceptable MAC algorithms from the client to the server. Can be empty if the value is missing or the message is malformed

◆ getMacAlgorithmsServerToClient()

std::string pcpp::SSHKeyExchangeInitMessage::getMacAlgorithmsServerToClient ( )
inline
Returns
A comma-separated list of acceptable MAC algorithms from the server to the client. Can be empty if the value is missing or the message is malformed

◆ getServerHostKeyAlgorithms()

std::string pcpp::SSHKeyExchangeInitMessage::getServerHostKeyAlgorithms ( )
inline
Returns
A comma-separated list of the algorithms supported for the server host key. Can be empty if the value is missing or the message is malformed

◆ isFirstKexPacketFollows()

bool pcpp::SSHKeyExchangeInitMessage::isFirstKexPacketFollows ( )
Returns
Indicates whether a guessed key exchange packet follows. If a guessed packet will be sent, the return value is true. If no guessed packet will be sent or if this value is missing, the return value is false.