PcapPlusPlus  24.09
SSLCommon.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <stdint.h>
5 
15 namespace pcpp
16 {
17 
22 #pragma pack(push, 1)
24  {
26  uint8_t recordType;
28  uint16_t recordVersion;
30  uint16_t length;
31  };
32 #pragma pack(pop)
33 
38 #pragma pack(push, 1)
40  {
42  uint8_t handshakeType;
44  uint8_t length1;
46  uint16_t length2;
47  };
48 #pragma pack(pop)
49 
54 #pragma pack(push, 1)
56  {
58  uint16_t handshakeVersion;
60  uint8_t random[32];
61  };
62 #pragma pack(pop)
63 
68 #pragma pack(push, 1)
70  {
73  };
74 #pragma pack(pop)
75 
80 #pragma pack(push, 1)
82  {
84  uint8_t alertLevel;
87  };
88 #pragma pack(pop)
89 
94  {
98  SSL_ALERT = 21,
103  };
104 
112  {
113  public:
118  {
120  SSL2 = 0x0200,
122  SSL3 = 0x0300,
124  TLS1_0 = 0x0301,
126  TLS1_1 = 0x0302,
128  TLS1_2 = 0x0303,
130  TLS1_3 = 0x0304,
132  TLS1_3_D14 = 0x7f0e,
134  TLS1_3_D15 = 0x7f0f,
136  TLS1_3_D16 = 0x7f10,
138  TLS1_3_D17 = 0x7f11,
140  TLS1_3_D18 = 0x7f12,
142  TLS1_3_D19 = 0x7f13,
144  TLS1_3_D20 = 0x7f14,
146  TLS1_3_D21 = 0x7f15,
148  TLS1_3_D22 = 0x7f16,
150  TLS1_3_D23 = 0x7f17,
152  TLS1_3_D24 = 0x7f18,
154  TLS1_3_D25 = 0x7f19,
156  TLS1_3_D26 = 0x7f1a,
158  TLS1_3_D27 = 0x7f1b,
160  TLS1_3_D28 = 0x7f1c,
162  TLS1_3_FBD23 = 0xfb17,
164  TLS1_3_FBD26 = 0xfb1a,
166  Unknown = 0
167  };
168 
174  explicit SSLVersion(uint16_t sslVersionValue)
175  {
176  m_SSLVersionValue = sslVersionValue;
177  }
178 
186  SSLVersionEnum asEnum(bool countTlsDraftsAs1_3 = false);
187 
191  uint16_t asUInt()
192  {
193  return m_SSLVersionValue;
194  }
195 
203  std::string toString(bool countTlsDraftsAs1_3 = false);
204 
205  private:
206  uint16_t m_SSLVersionValue;
207 
208  // unimplemented empty c'tor
209  SSLVersion();
210  };
211 
216  {
247  };
248 
253  {
260  };
261 
266  {
276  SSL_ALERT_RECORD_OVERFLOW = 22,
318  SSL_ALERT_ENCRYPTED = 255
319  };
320 
325  {
352  };
353 
358  {
385  };
386 
391  {
468  };
469 
474  {
495  };
496 
501  {
578  };
579 
584  {
607  };
608 
609 } // namespace pcpp
Definition: SSLCommon.h:112
uint16_t asUInt()
Definition: SSLCommon.h:191
std::string toString(bool countTlsDraftsAs1_3=false)
SSLVersion(uint16_t sslVersionValue)
Definition: SSLCommon.h:174
SSLVersionEnum asEnum(bool countTlsDraftsAs1_3=false)
SSLVersionEnum
Definition: SSLCommon.h:118
@ TLS1_3_D14
Definition: SSLCommon.h:132
@ TLS1_2
Definition: SSLCommon.h:128
@ TLS1_3_D22
Definition: SSLCommon.h:148
@ TLS1_0
Definition: SSLCommon.h:124
@ SSL3
Definition: SSLCommon.h:122
@ TLS1_3_D21
Definition: SSLCommon.h:146
@ SSL2
Definition: SSLCommon.h:120
@ TLS1_3_D20
Definition: SSLCommon.h:144
@ TLS1_3_D18
Definition: SSLCommon.h:140
@ TLS1_3_FBD26
Definition: SSLCommon.h:164
@ TLS1_3_D28
Definition: SSLCommon.h:160
@ TLS1_3_D16
Definition: SSLCommon.h:136
@ Unknown
Definition: SSLCommon.h:166
@ TLS1_3_D27
Definition: SSLCommon.h:158
@ TLS1_3_D15
Definition: SSLCommon.h:134
@ TLS1_3_D24
Definition: SSLCommon.h:152
@ TLS1_1
Definition: SSLCommon.h:126
@ TLS1_3_D19
Definition: SSLCommon.h:142
@ TLS1_3_D26
Definition: SSLCommon.h:156
@ TLS1_3_D25
Definition: SSLCommon.h:154
@ TLS1_3
Definition: SSLCommon.h:130
@ TLS1_3_FBD23
Definition: SSLCommon.h:162
@ TLS1_3_D17
Definition: SSLCommon.h:138
@ TLS1_3_D23
Definition: SSLCommon.h:150
The main namespace for the PcapPlusPlus lib.
SSLAlertDescription
Definition: SSLCommon.h:266
@ SSL_ALERT_DECRYPTION_FAILED
Definition: SSLCommon.h:274
@ SSL_ALERT_NO_CERTIFICATE
Definition: SSLCommon.h:282
@ SSL_ALERT_DECOMPRESSION_FAILURE
Definition: SSLCommon.h:278
@ SSL_ALERT_ACCESS_DENIED
Definition: SSLCommon.h:298
@ SSL_ALERT_UNEXPECTED_MESSAGE
Definition: SSLCommon.h:270
@ SSL_ALERT_UNSUPPORTED_EXTENSION
Definition: SSLCommon.h:316
@ SSL_ALERT_BAD_CERTIFICATE
Definition: SSLCommon.h:284
@ SSL_ALERT_ILLEGAL_PARAMETER
Definition: SSLCommon.h:294
@ SSL_ALERT_INSUFFICIENT_SECURITY
Definition: SSLCommon.h:308
@ SSL_ALERT_INTERNAL_ERROR
Definition: SSLCommon.h:310
@ SSL_ALERT_USER_CANCELLED
Definition: SSLCommon.h:312
@ SSL_ALERT_CERTIFICATE_EXPIRED
Definition: SSLCommon.h:290
@ SSL_ALERT_CERTIFICATE_UNKNOWN
Definition: SSLCommon.h:292
@ SSL_ALERT_UNSUPPORTED_CERTIFICATE
Definition: SSLCommon.h:286
@ SSL_ALERT_CLOSE_NOTIFY
Definition: SSLCommon.h:268
@ SSL_ALERT_BAD_RECORD_MAC
Definition: SSLCommon.h:272
@ SSL_ALERT_HANDSHAKE_FAILURE
Definition: SSLCommon.h:280
@ SSL_ALERT_ENCRYPTED
Definition: SSLCommon.h:318
@ SSL_ALERT_UNKNOWN_CA
Definition: SSLCommon.h:296
@ SSL_ALERT_NO_RENEGOTIATION
Definition: SSLCommon.h:314
@ SSL_ALERT_DECODE_ERROR
Definition: SSLCommon.h:300
@ SSL_ALERT_PROTOCOL_VERSION
Definition: SSLCommon.h:306
@ SSL_ALERT_CERTIFICATE_REVOKED
Definition: SSLCommon.h:288
@ SSL_ALERT_EXPORT_RESTRICTION
Definition: SSLCommon.h:304
@ SSL_ALERT_DECRYPT_ERROR
Definition: SSLCommon.h:302
SSLKeyExchangeAlgorithm
Definition: SSLCommon.h:325
@ SSL_KEYX_DH
Definition: SSLCommon.h:331
@ SSL_KEYX_GOST
Definition: SSLCommon.h:345
@ SSL_KEYX_PCT
Definition: SSLCommon.h:349
@ SSL_KEYX_Unknown
Definition: SSLCommon.h:351
@ SSL_KEYX_DHE
Definition: SSLCommon.h:333
@ SSL_KEYX_KRB5
Definition: SSLCommon.h:341
@ SSL_KEYX_ECDH
Definition: SSLCommon.h:335
@ SSL_KEYX_PSK
Definition: SSLCommon.h:343
@ SSL_KEYX_FORTEZZA
Definition: SSLCommon.h:339
@ SSL_KEYX_ECDHE
Definition: SSLCommon.h:337
@ SSL_KEYX_RSA
Definition: SSLCommon.h:329
@ SSL_KEYX_SRP
Definition: SSLCommon.h:347
@ SSL_KEYX_NULL
Definition: SSLCommon.h:327
SSLRecordType
Definition: SSLCommon.h:94
@ SSL_ALERT
Definition: SSLCommon.h:98
@ SSL_CHANGE_CIPHER_SPEC
Definition: SSLCommon.h:96
@ SSL_HANDSHAKE
Definition: SSLCommon.h:100
@ SSL_APPLICATION_DATA
Definition: SSLCommon.h:102
SSLExtensionType
Definition: SSLCommon.h:501
@ SSL_EXT_ENCRYPT_THEN_MAC
Definition: SSLCommon.h:547
@ SSL_EXT_EC_POINT_FORMATS
Definition: SSLCommon.h:525
@ SSL_EXT_SUPPORTED_GROUPS
Definition: SSLCommon.h:523
@ SSL_EXT_SERVER_AUTHZ
Definition: SSLCommon.h:519
@ SSL_EXT_KEY_SHARE
Definition: SSLCommon.h:573
@ SSL_EXT_SERVER_NAME
Definition: SSLCommon.h:503
@ SSL_EXT_EXTENDED_MASTER_SECRET
Definition: SSLCommon.h:549
@ SSL_EXT_HEARTBEAT
Definition: SSLCommon.h:533
@ SSL_EXT_SUPPORTED_VERSIONS
Definition: SSLCommon.h:559
@ SSL_EXT_STATUS_REQUEST
Definition: SSLCommon.h:513
@ SSL_EXT_APPLICATION_LAYER_PROTOCOL_NEGOTIATION
Definition: SSLCommon.h:535
@ SSL_EXT_PRE_SHARED_KEY
Definition: SSLCommon.h:555
@ SSL_EXT_PSK_KEY_EXCHANGE_MODES
Definition: SSLCommon.h:563
@ SSL_EXT_MAX_FRAGMENT_LENGTH
Definition: SSLCommon.h:505
@ SSL_EXT_EARLY_DATA
Definition: SSLCommon.h:557
@ SSL_EXT_CERT_TYPE
Definition: SSLCommon.h:521
@ SSL_EXT_SIGNED_CERTIFICATE_TIMESTAMP
Definition: SSLCommon.h:539
@ SSL_EXT_SIGNATURE_ALGORITHMS
Definition: SSLCommon.h:529
@ SSL_EXT_SERVER_CERTIFICATE_TYPE
Definition: SSLCommon.h:543
@ SSL_EXT_TRUNCATED_HMAC
Definition: SSLCommon.h:511
@ SSL_EXT_STATUS_REQUEST_V2
Definition: SSLCommon.h:537
@ SSL_EXT_SIGNATURE_ALGORITHM_CERT
Definition: SSLCommon.h:571
@ SSL_EXT_CLIENT_CERTIFICATE_URL
Definition: SSLCommon.h:507
@ SSL_EXT_CLIENT_AUTHZ
Definition: SSLCommon.h:517
@ SSL_EXT_USE_SRTP
Definition: SSLCommon.h:531
@ SSL_EXT_COOKIE
Definition: SSLCommon.h:561
@ SSL_EXT_SESSIONTICKET_TLS
Definition: SSLCommon.h:553
@ SSL_EXT_CERTIFICATE_AUTHORITIES
Definition: SSLCommon.h:565
@ SSL_EXT_CLIENT_CERTIFICATE_TYPE
Definition: SSLCommon.h:541
@ SSL_EXT_Unknown
Definition: SSLCommon.h:577
@ SSL_EXT_PADDING
Definition: SSLCommon.h:545
@ SSL_EXT_POST_HANDSHAKE_AUTH
Definition: SSLCommon.h:569
@ SSL_EXT_RENEGOTIATION_INFO
Definition: SSLCommon.h:575
@ SSL_EXT_TOKEN_BINDING
Definition: SSLCommon.h:551
@ SSL_EXT_OLD_FILTERS
Definition: SSLCommon.h:567
@ SSL_EXT_SRP
Definition: SSLCommon.h:527
@ SSL_EXT_TRUSTED_CA_KEYS
Definition: SSLCommon.h:509
@ SSL_EXT_USER_MAPPING
Definition: SSLCommon.h:515
SSLClientCertificateType
Definition: SSLCommon.h:584
@ SSL_CCT_ECDSA_SIGN
Definition: SSLCommon.h:600
@ SSL_CCT_RSA_FIXED_DH
Definition: SSLCommon.h:590
@ SSL_CCT_DSS_SIGN
Definition: SSLCommon.h:588
@ SSL_CCT_RSA_SIGN
Definition: SSLCommon.h:586
@ SSL_CCT_RSA_EPHEMERAL_DH_RESERVED
Definition: SSLCommon.h:594
@ SSL_CCT_DSS_FIXED_DH
Definition: SSLCommon.h:592
@ SSL_CCT_UNKNOWN
Definition: SSLCommon.h:606
@ SSL_CCT_DSS_EPHEMERAL_DH_RESERVED
Definition: SSLCommon.h:596
@ SSL_CCT_ECDSA_FIXED_ECDH
Definition: SSLCommon.h:604
@ SSL_CCT_FORTEZZA_DMS_RESERVED
Definition: SSLCommon.h:598
@ SSL_CCT_RSA_FIXED_ECDH
Definition: SSLCommon.h:602
SSLAlertLevel
Definition: SSLCommon.h:253
@ SSL_ALERT_LEVEL_FATAL
Definition: SSLCommon.h:257
@ SSL_ALERT_LEVEL_WARNING
Definition: SSLCommon.h:255
@ SSL_ALERT_LEVEL_ENCRYPTED
Definition: SSLCommon.h:259
SSLSymetricEncryptionAlgorithm
Definition: SSLCommon.h:391
@ SSL_SYM_CAMELLIA_256_CBC
Definition: SSLCommon.h:429
@ SSL_SYM_GOST28147
Definition: SSLCommon.h:427
@ SSL_SYM_AES_128_CCM
Definition: SSLCommon.h:463
@ SSL_SYM_RC4_64
Definition: SSLCommon.h:451
@ SSL_SYM_RC2_CBC_128_CBC
Definition: SSLCommon.h:443
@ SSL_SYM_RC2_CBC_40
Definition: SSLCommon.h:399
@ SSL_SYM_ARIA_256_GCM
Definition: SSLCommon.h:459
@ SSL_SYM_IDEA_CBC
Definition: SSLCommon.h:401
@ SSL_SYM_AES_256_CBC
Definition: SSLCommon.h:415
@ SSL_SYM_ARIA_128_CBC
Definition: SSLCommon.h:453
@ SSL_SYM_RC4_40
Definition: SSLCommon.h:395
@ SSL_SYM_AES_128_CBC
Definition: SSLCommon.h:413
@ SSL_SYM_SEED_CBC
Definition: SSLCommon.h:431
@ SSL_SYM_FORTEZZA_CBC
Definition: SSLCommon.h:409
@ SSL_SYM_AES_128
Definition: SSLCommon.h:433
@ SSL_SYM_CAMELLIA_128_CBC
Definition: SSLCommon.h:417
@ SSL_SYM_3DES_EDE_CBC
Definition: SSLCommon.h:407
@ SSL_SYM_AES_256_GCM
Definition: SSLCommon.h:439
@ SSL_SYM_ARIA_256_CBC
Definition: SSLCommon.h:455
@ SSL_SYM_IDEA_128_CBC
Definition: SSLCommon.h:445
@ SSL_SYM_NULL
Definition: SSLCommon.h:393
@ SSL_SYM_CHACHA20_POLY1305
Definition: SSLCommon.h:461
@ SSL_SYM_RC2_CBC_56
Definition: SSLCommon.h:425
@ SSL_SYM_ARIA_128_GCM
Definition: SSLCommon.h:457
@ SSL_SYM_DES_CBC_40
Definition: SSLCommon.h:411
@ SSL_SYM_CAMELLIA_256_GCM
Definition: SSLCommon.h:421
@ SSL_SYM_CAMELLIA_128_GCM
Definition: SSLCommon.h:419
@ SSL_SYM_AES_128_GCM
Definition: SSLCommon.h:437
@ SSL_SYM_DES40_CBC
Definition: SSLCommon.h:403
@ SSL_SYM_RC4_56
Definition: SSLCommon.h:423
@ SSL_SYM_AES_256
Definition: SSLCommon.h:435
@ SSL_SYM_DES_64_CBC
Definition: SSLCommon.h:447
@ SSL_SYM_RC4_128_EXPORT40
Definition: SSLCommon.h:441
@ SSL_SYM_DES_192_EDE3_CBC
Definition: SSLCommon.h:449
@ SSL_SYM_RC4_128
Definition: SSLCommon.h:397
@ SSL_SYM_Unknown
Definition: SSLCommon.h:467
@ SSL_SYM_DES_CBC
Definition: SSLCommon.h:405
@ SSL_SYM_AES_128_CCM_8
Definition: SSLCommon.h:465
SSLAuthenticationAlgorithm
Definition: SSLCommon.h:358
@ SSL_AUTH_Unknown
Definition: SSLCommon.h:384
@ SSL_AUTH_SHA
Definition: SSLCommon.h:378
@ SSL_AUTH_RSA
Definition: SSLCommon.h:362
@ SSL_AUTH_PSK
Definition: SSLCommon.h:372
@ SSL_AUTH_GOST
Definition: SSLCommon.h:376
@ SSL_AUTH_ECDSA
Definition: SSLCommon.h:374
@ SSL_AUTH_PCT
Definition: SSLCommon.h:380
@ SSL_AUTH_KRB5
Definition: SSLCommon.h:370
@ SSL_AUTH_DHE
Definition: SSLCommon.h:382
@ SSL_AUTH_DSS
Definition: SSLCommon.h:364
@ SSL_AUTH_NULL
Definition: SSLCommon.h:360
@ SSL_AUTH_KEA
Definition: SSLCommon.h:368
@ SSL_AUTH_anon
Definition: SSLCommon.h:366
SSLHandshakeType
Definition: SSLCommon.h:216
@ SSL_CERTIFICATE
Definition: SSLCommon.h:230
@ SSL_CERTIFICATE_VERIFY
Definition: SSLCommon.h:238
@ SSL_SERVER_DONE
Definition: SSLCommon.h:236
@ SSL_CERTIFICATE_REQUEST
Definition: SSLCommon.h:234
@ SSL_CLIENT_KEY_EXCHANGE
Definition: SSLCommon.h:240
@ SSL_KEY_UPDATE
Definition: SSLCommon.h:244
@ SSL_CLIENT_HELLO
Definition: SSLCommon.h:220
@ SSL_SERVER_KEY_EXCHANGE
Definition: SSLCommon.h:232
@ SSL_FINISHED
Definition: SSLCommon.h:242
@ SSL_SERVER_HELLO
Definition: SSLCommon.h:222
@ SSL_HANDSHAKE_UNKNOWN
Definition: SSLCommon.h:246
@ SSL_END_OF_EARLY_DATE
Definition: SSLCommon.h:226
@ SSL_ENCRYPTED_EXTENSIONS
Definition: SSLCommon.h:228
@ SSL_HELLO_REQUEST
Definition: SSLCommon.h:218
@ SSL_NEW_SESSION_TICKET
Definition: SSLCommon.h:224
SSLHashingAlgorithm
Definition: SSLCommon.h:474
@ SSL_HASH_SHA384
Definition: SSLCommon.h:488
@ SSL_HASH_CCM
Definition: SSLCommon.h:490
@ SSL_HASH_SHA256
Definition: SSLCommon.h:482
@ SSL_HASH_NULL
Definition: SSLCommon.h:476
@ SSL_HASH_GOSTR3411
Definition: SSLCommon.h:486
@ SSL_HASH_CCM_8
Definition: SSLCommon.h:492
@ SSL_HASH_Unknown
Definition: SSLCommon.h:494
@ SSL_HASH_MD5
Definition: SSLCommon.h:478
@ SSL_HASH_GOST28147
Definition: SSLCommon.h:484
@ SSL_HASH_SHA
Definition: SSLCommon.h:480
Definition: SSLCommon.h:82
uint8_t alertLevel
Definition: SSLCommon.h:84
uint8_t alertDescription
Definition: SSLCommon.h:86
Definition: SSLCommon.h:70
uint8_t changeCipherSpec
Definition: SSLCommon.h:72
Definition: SSLCommon.h:56
uint8_t random[32]
Definition: SSLCommon.h:60
uint16_t handshakeVersion
Definition: SSLCommon.h:58
Definition: SSLCommon.h:40
uint8_t handshakeType
Definition: SSLCommon.h:42
uint16_t length2
Definition: SSLCommon.h:46
uint8_t length1
Definition: SSLCommon.h:44
Definition: SSLCommon.h:24
uint8_t recordType
Definition: SSLCommon.h:26
uint16_t recordVersion
Definition: SSLCommon.h:28
uint16_t length
Definition: SSLCommon.h:30