PcapPlusPlus  22.05
pcpp::SSLCertificateMessage Class Reference

#include <SSLHandshake.h>

Inheritance diagram for pcpp::SSLCertificateMessage:
pcpp::SSLHandshakeMessage

Public Member Functions

 SSLCertificateMessage (uint8_t *data, size_t dataLen, SSLHandshakeLayer *container)
 
int getNumOfCertificates () const
 
SSLx509CertificategetCertificate (int index) const
 
std::string toString () const
 
- Public Member Functions inherited from pcpp::SSLHandshakeMessage
virtual SSLHandshakeType getHandshakeType () const
 
virtual size_t getMessageLength () const
 
virtual bool isMessageComplete () const
 
SSLHandshakeLayergetContainingLayer () const
 

Additional Inherited Members

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

Detailed Description

Represents SSL/TLS certificate message (type 11). Inherits from SSLHandshakeMessage and adds parsing functionality such as extracting the certificates data. Notice that in most cases this message is spread over more than 1 packet as its size is too big for a single packet. So SSLCertificateMessage instance will be created just for the first part of the message - the one encapsulated in the first packet. Other parts (encapsulated in the following packets) won't be recognized as SSLCertificateMessage messages

Constructor & Destructor Documentation

◆ SSLCertificateMessage()

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

C'tor for this class. Currently only in use in SSLHandshakeMessage::createHandshakeMessage() and should 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

◆ getCertificate()

SSLx509Certificate* pcpp::SSLCertificateMessage::getCertificate ( int  index) const

Get a certificate by index

Parameters
[in]indexThe index of the certificate to retrieve
Returns
A pointer to the certificate object. Notice that if index < 0 or index > num of certificates encapsulated in current packet a NULL value will be returned

◆ getNumOfCertificates()

int pcpp::SSLCertificateMessage::getNumOfCertificates ( ) const
Returns
The number of certificates encapsulated in this message (as written in the 'length' field of the message). Notice that because the message may spread over several packets, not all certificates will necessarily be in this packet. So, for example, there may be a case where this method return 3 (message contains 3 certificates) but this message actually contains only 1 certificate as the other 2 are spread over the other packets

◆ toString()

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

Implements pcpp::SSLHandshakeMessage.