PcapPlusPlus
pcpp::SSLServerHelloMessage Class Reference

#include <SSLHandshake.h>

Inheritance diagram for pcpp::SSLServerHelloMessage:
pcpp::SSLHandshakeMessage

Public Member Functions

 SSLServerHelloMessage (uint8_t *data, size_t dataLen, SSLHandshakeLayer *container)
 
ssl_tls_client_server_hellogetServerHelloHeader ()
 
SSLVersion getHandshakeVersion ()
 
uint8_t getSessionIDLength ()
 
uint8_t * getSessionID ()
 
SSLCipherSuitegetCipherSuite ()
 
uint8_t getCompressionMethodsValue ()
 
int getExtensionCount ()
 
uint16_t getExtensionsLenth ()
 
SSLExtensiongetExtension (int index)
 
SSLExtensiongetExtensionOfType (uint16_t type)
 
SSLExtensiongetExtensionOfType (SSLExtensionType type)
 
template<class TExtension >
TExtension * getExtensionOfType ()
 
std::string toString ()
 
- Public Member Functions inherited from pcpp::SSLHandshakeMessage
virtual SSLHandshakeType getHandshakeType ()
 
virtual size_t getMessageLength ()
 
virtual bool isMessageComplete ()
 
SSLHandshakeLayergetContainingLayer ()
 

Additional Inherited Members

- Static Public Member Functions inherited from pcpp::SSLHandshakeMessage
static SSLHandshakeMessagecreateHandhakeMessage (uint8_t *data, size_t dataLen, SSLHandshakeLayer *container)
 

Detailed Description

Represents SSL/TLS server-hello message (type 2). Inherits from SSLHandshakeMessage and adds parsing of all fields of this message including the message extensions, cipher-suite, etc.

Constructor & Destructor Documentation

◆ SSLServerHelloMessage()

pcpp::SSLServerHelloMessage::SSLServerHelloMessage ( uint8_t *  data,
size_t  dataLen,
SSLHandshakeLayer container 
)

C'tor for this class. Currently only in use in SSLHandshakeMessage::createHandhakeMessage() and shouldn't be used by a user

Parameters
[in]dataThe message as raw data
[in]dataLenMessage raw data length in bytes
[in]containerThe SSL handshake layer which shall contain this message

Member Function Documentation

◆ getCipherSuite()

SSLCipherSuite* pcpp::SSLServerHelloMessage::getCipherSuite ( )
Returns
A pointer to the cipher suite encapsulated in this message (server-hello message contains one cipher-suite, the one that will be used to for encryption between client and server)

◆ getCompressionMethodsValue()

uint8_t pcpp::SSLServerHelloMessage::getCompressionMethodsValue ( )
Returns
The value of the compression method byte

◆ getExtension()

SSLExtension* pcpp::SSLServerHelloMessage::getExtension ( int  index)

Get a pointer to an extension by index. The extensions are numbered according to their order of appearance in the message. If index is out of bounds (less than 0 or larger than total amount of extensions) NULL will be returned

Parameters
[in]indexThe index of the extension to return
Returns
The pointer to the extension or NULL if index is out of bounds

◆ getExtensionCount()

int pcpp::SSLServerHelloMessage::getExtensionCount ( )
Returns
The number of extensions in this message

◆ getExtensionOfType() [1/3]

SSLExtension* pcpp::SSLServerHelloMessage::getExtensionOfType ( uint16_t  type)

Get a pointer to an extension by numeric type field. Every extension has a 2-byte numeric value representing its type (for example: renegotiation info extension type is 0x1ff). This method gets the type and returns a pointer to the extension object

Parameters
[in]typeThe 2-byte numeric type of the extension
Returns
A pointer to the extension object of NULL if this type doesn't exist in this message

◆ getExtensionOfType() [2/3]

SSLExtension* pcpp::SSLServerHelloMessage::getExtensionOfType ( SSLExtensionType  type)

Get a pointer to an extension by its enum type

Parameters
[in]typeThe type of extension to return
Returns
A pointer to the extension object or NULL if this type doesn't exist in this message

◆ getExtensionOfType() [3/3]

template<class TExtension >
TExtension * pcpp::SSLServerHelloMessage::getExtensionOfType ( )

Get a pointer to an extension by its class type. This is a templated method that is used with the type of the requested extension and returns the first extension instance of this type

Returns
A pointer to the extension object or NULL if this extension type doesn't exist in this message

◆ getExtensionsLenth()

uint16_t pcpp::SSLServerHelloMessage::getExtensionsLenth ( )
Returns
The size (in bytes) of all extensions data in this message. Extracted from the "extensions length" field

◆ getHandshakeVersion()

SSLVersion pcpp::SSLServerHelloMessage::getHandshakeVersion ( )
Returns
Handshake SSL/TLS version (notice it may be different than SSLLayer::getRecordVersion(). Each client-hello or server-hello message has both record version and handshake version and they may differ from one another)

◆ getServerHelloHeader()

ssl_tls_client_server_hello* pcpp::SSLServerHelloMessage::getServerHelloHeader ( )
inline
Returns
A struct containing common fields for client-hello and server-hello messages. Notice this points directly to the data, so every change will change the actual packet data

◆ getSessionID()

uint8_t* pcpp::SSLServerHelloMessage::getSessionID ( )
Returns
Session ID as byte array. If server-hello message doesn't include session ID NULL will be returned

◆ getSessionIDLength()

uint8_t pcpp::SSLServerHelloMessage::getSessionIDLength ( )
Returns
Session ID length in bytes. If server-hello message doesn't include session ID 0 will be returned

◆ toString()

std::string pcpp::SSLServerHelloMessage::toString ( )
virtual
Returns
A string representation of the message type (e.g "Client Hello message")

Implements pcpp::SSLHandshakeMessage.