PcapPlusPlus  21.05
pcpp::SSLVersion Class Reference

#include <SSLCommon.h>

Public Types

enum  SSLVersionEnum {
  SSL2 = 0x0200, SSL3 = 0x0300, TLS1_0 = 0x0301, TLS1_1 = 0x0302,
  TLS1_2 = 0x0303, TLS1_3 = 0x0304, TLS1_3_D14 = 0x7f0e, TLS1_3_D15 = 0x7f0f,
  TLS1_3_D16 = 0x7f10, TLS1_3_D17 = 0x7f11, TLS1_3_D18 = 0x7f12, TLS1_3_D19 = 0x7f13,
  TLS1_3_D20 = 0x7f14, TLS1_3_D21 = 0x7f15, TLS1_3_D22 = 0x7f16, TLS1_3_D23 = 0x7f17,
  TLS1_3_D24 = 0x7f18, TLS1_3_D25 = 0x7f19, TLS1_3_D26 = 0x7f1a, TLS1_3_D27 = 0x7f1b,
  TLS1_3_D28 = 0x7f1c, TLS1_3_FBD23 = 0xfb17, TLS1_3_FBD26 = 0xfb1a, Unknown = 0
}
 

Public Member Functions

 SSLVersion (uint16_t sslVersionValue)
 
SSLVersionEnum asEnum (bool countTlsDraftsAs1_3=false)
 
uint16_t asUInt ()
 
std::string toString (bool countTlsDraftsAs1_3=false)
 

Detailed Description

A wrapper class for SSL/TLS versions. The SSL/TLS version is typically represented by a 2-byte number, for example TLS 1.2 is represented by 0x0303. This class wraps the numeric value and provides methods to convert it into an enum, string, etc.

Member Enumeration Documentation

◆ SSLVersionEnum

SSL/TLS versions enum

Enumerator
SSL2 

SSL 2.0

SSL3 

SSL 3.0

TLS1_0 

TLS 1.0

TLS1_1 

TLS 1.1

TLS1_2 

TLS 1.2

TLS1_3 

TLS 1.3

TLS1_3_D14 

TLS 1.3 (draft 14)

TLS1_3_D15 

TLS 1.3 (draft 15)

TLS1_3_D16 

TLS 1.3 (draft 16)

TLS1_3_D17 

TLS 1.3 (draft 17)

TLS1_3_D18 

TLS 1.3 (draft 18)

TLS1_3_D19 

TLS 1.3 (draft 19)

TLS1_3_D20 

TLS 1.3 (draft 20)

TLS1_3_D21 

TLS 1.3 (draft 21)

TLS1_3_D22 

TLS 1.3 (draft 22)

TLS1_3_D23 

TLS 1.3 (draft 23)

TLS1_3_D24 

TLS 1.3 (draft 24)

TLS1_3_D25 

TLS 1.3 (draft 25)

TLS1_3_D26 

TLS 1.3 (draft 26)

TLS1_3_D27 

TLS 1.3 (draft 27)

TLS1_3_D28 

TLS 1.3 (draft 28)

TLS1_3_FBD23 

TLS 1.3 (Facebook draft 23)

TLS1_3_FBD26 

TLS 1.3 (Facebook draft 26)

Unknown 

Unknown value

Constructor & Destructor Documentation

◆ SSLVersion()

pcpp::SSLVersion::SSLVersion ( uint16_t  sslVersionValue)
inline

A c'tor for this class.

Parameters
[in]sslVersionValueThe numeric value representing this SSL/TLS version. For example: for TLS 1.2 this would be 0x0303.

Member Function Documentation

◆ asEnum()

SSLVersionEnum pcpp::SSLVersion::asEnum ( bool  countTlsDraftsAs1_3 = false)
Returns
An enum value of type SSLVersion::SSLVersionEnum representing the SSL/TLS version. If the numeric value is an invalid SSL/TLS version SSLVersion::Unknown will be returned.
Parameters
[in]countTlsDraftsAs1_3A flag indicating whether to return the enum value SSLVersion::TLS1_3 for all TLS 1.3 drafts. If set to "true" all TLS 1.3 draft values (i.e 0x7f0e - 0x7f1c, 0xfb17, 0xfb1a) will return SSLVersion::TLS1_3, otherwise the corresponding enum values will be returned. The default value is "false".

◆ asUInt()

uint16_t pcpp::SSLVersion::asUInt ( )
inline
Returns
The numeric value of the SSL/TLs version

◆ toString()

std::string pcpp::SSLVersion::toString ( bool  countTlsDraftsAs1_3 = false)
Returns
A string representation of the SSL/TLS version. For example: for TLS 1.2 the string "TLS 1.2" is returned. If the numeric value is an invalid SSL/TLS version the string "Unknown" will be returned.
Parameters
[in]countTlsDraftsAs1_3A flag indicating whether to return the string value "TLS 1.3" for all TLS 1.3 drafts. If set to "true" all TLS 1.3 draft values (i.e 0x7f0e - 0x7f1c, 0xfb17, 0xfb1a) will return "TLS 1.3", otherwise the corresponding string values will be returned. The default value is "false".