PcapPlusPlus
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 ()
 
SSLx509CertificategetCertificate (int index)
 
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 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

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

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

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

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
int pcpp::SSLCertificateMessage::getNumOfCertificates ( )
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
std::string pcpp::SSLCertificateMessage::toString ( )
virtual
Returns
A string representation of the message type (e.g "Client Hello message")

Implements pcpp::SSLHandshakeMessage.