Coverage Report

Created: 2026-12-01 07:11

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/PcapPlusPlus/Packet++/header/SSHLayer.h
Line
Count
Source
1
#pragma once
2
3
#include "Layer.h"
4
5
/// @file
6
/// This file introduces classes and structures that represent the SSH (Secure Shell) protocol.
7
///
8
/// An overview of this protocol can be found here: https://en.wikipedia.org/wiki/Ssh_(Secure_Shell)
9
///
10
/// For more details please refer to RFC 4253: https://tools.ietf.org/html/rfc4253
11
///
12
/// These current implementation supports parsing of SSH packets when possible (meaning when they are not encrypted).
13
/// Creation and editing of SSH packets is currently __not supported__.
14
///
15
/// SSH typically uses TCP port 22 so PcapPlusPlus assumes all traffic on this port is SSH traffic.
16
/// PcapPlusPlus uses some heuristics to determine the type of the SSH message (which will be covered later).
17
/// If it doesn't find a match to one of the other SSH messages, it assumes it is an encrypted SSH message.
18
///
19
/// Following is an overview of the SSH protocol classes currently supported in PcapPlusPlus. They cover the different
20
/// messages of the SSH protocol:
21
///
22
/// @code{.unparsed}
23
///                          +----------------------------+      SSH version identification
24
///                      +---|  SSHIdentificationMessage  | ===> as described here:
25
///                      |   +----------------------------+      https://tools.ietf.org/html/rfc4253#section-4.2
26
///                      |
27
///  +------------+      |   +----------------------------+      SSH handshake message
28
///  |  SSHLayer  |------+---|  SSHHandshakeMessage       | ===> which is typically one of the messages described here:
29
///  | (abstract) |      |   +----------------------------+      https://tools.ietf.org/html/rfc4253#section-12
30
///  +------------+      |                 |
31
///                      |                 |     +----------------------------+
32
///                      |                 +-----|  SSHKeyExchangeInitMessage | ===> SSH Key Exchange message
33
///                      |                       +----------------------------+      as described here:
34
///                      |                                                 https://tools.ietf.org/html/rfc4253#section-7
35
///                      |
36
///                      |   +----------------------------+
37
///                      +---|  SSHEncryptedMessage       | ===> An encrypted SSH message
38
///                          +----------------------------+
39
///
40
/// @endcode
41
/// The following points describe the heuristics for deciding the
42
/// message type for each packet:
43
/// 1. If the data starts with the characters "SSH-" and ends with
44
/// "\n" (or "\r\n") it's assumed the message is of type
45
///    pcpp#SSHIdentificationMessage
46
/// 2. Try to determine if this is a non-encrypted SSH handshake
47
/// message:
48
///    - Look at the first 4 bytes of the data which may contain
49
///    the packet length and see if the value is smaller of
50
///      equal than the entire layer length.
51
///    - The next byte contains the padding length, check if it's
52
///    smaller or equal than the packet length
53
///    - The next byte contains the message type, check if the
54
///    value is a valid message type as described in:
55
///      <https://tools.ietf.org/html/rfc4253#section-12>
56
///
57
///    If all of these condition are met, this message is either
58
///    pcpp#SSHKeyExchangeInitMessage (if message type is
59
///    pcpp#SSHHandshakeMessage#SSH_MSG_KEX_INIT) or
60
///    pcpp#SSHHandshakeMessage (for all other message types)
61
/// 3. If non of these conditions are met, it is assumed this is an
62
/// encrypted message (pcpp#SSHEncryptedMessage)
63
64
/// @namespace pcpp
65
/// @brief The main namespace for the PcapPlusPlus lib
66
namespace pcpp
67
{
68
  /// @class SSHLayer
69
  /// This is the base class for the SSH layer. It is an abstract class that cannot be instantiated.
70
  /// It holds some common functionality, but its most important method is createSSHMessage()
71
  /// which takes raw data and creates an SSH message according to the heuristics described
72
  /// in the SSHLayer.h file description
73
  class SSHLayer : public Layer
74
  {
75
  public:
76
    /// A static method that takes raw packet data and uses the heuristics described in the
77
    /// SSHLayer.h file description to create an SSH layer instance. This method assumes the data is
78
    /// indeed SSH data and not some other arbitrary data
79
    /// @param[in] data A pointer to the raw data
80
    /// @param[in] dataLen Size of the data in bytes
81
    /// @param[in] prevLayer A pointer to the previous layer
82
    /// @param[in] packet A pointer to the Packet instance where layer will be stored in
83
    /// @return An instance of one of the classes that inherit SSHLayer as described in the
84
    /// SSHLayer.h file description
85
    static SSHLayer* createSSHMessage(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet);
86
87
    /// A static method that takes src and dst ports and determines whether it's SSH traffic or not.
88
    /// @param[in] portSrc The source TCP port to examine
89
    /// @param[in] portDst The dest TCP port to examine
90
    /// @return Currently the implementation is very simple and returns "true" if either src or dst ports
91
    /// are equal to 22, "false" otherwise
92
    static bool isSSHPort(uint16_t portSrc, uint16_t portDst)
93
0
    {
94
0
      return portSrc == 22 || portDst == 22;
95
0
    }
96
97
    /// @struct SerializedFields
98
    /// Fields written by SSHLayer's serializeLayer(), in addition to
99
    /// Layer::SerializedFields.
100
    struct SerializedFields : Layer::SerializedFields
101
    {
102
      /// @return All field descriptors for SSHLayer
103
      static std::vector<FieldDescriptor> all()
104
0
      {
105
0
        auto result = Layer::SerializedFields::all();
106
0
        std::initializer_list<FieldDescriptor> extra{ SSHMessageType };
107
0
        std::copy(extra.begin(), extra.end(), std::back_inserter(result));
108
0
        return result;
109
0
      }
110
111
      /// @brief SSH message category, one of: "Identification", "Handshake", "Encrypted"
112
      static const FieldDescriptor SSHMessageType;
113
114
      // cppcheck-suppress duplInheritedMember
115
      /// Maximum field ID used by the layer.
116
      static constexpr uint16_t MaxID = Layer::SerializedFields::MaxID + 1;
117
    };
118
119
    // implement abstract methods
120
121
    /// Several SSH records can reside in a single packets. This method examins the remaining data and creates
122
    /// additional SSH records if applicable
123
    void parseNextLayer() override;
124
125
    /// Does nothing for this layer
126
    void computeCalculateFields() override
127
0
    {}
128
129
    OsiModelLayer getOsiModelLayer() const override
130
0
    {
131
0
      return OsiModelApplicationLayer;
132
0
    }
133
134
  protected:
135
    // protected c'tor, this class cannot be instantiated
136
    SSHLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet)
137
0
        : Layer(data, dataLen, prevLayer, packet, SSH)
138
0
    {}
139
140
  private:
141
    // this layer supports only parsing
142
    SSHLayer();
143
  };
144
145
  /// @class SSHIdentificationMessage
146
  /// A class that represents SSH identification message as described in RFC 4253:
147
  /// <https://tools.ietf.org/html/rfc4253#section-4.2>
148
  ///
149
  /// The message content is typically a string that contains the protocol version, software version and a few more
150
  /// details. This string can be retrieved using the getIdentificationMessage() method
151
  class SSHIdentificationMessage : public SSHLayer
152
  {
153
  public:
154
    /// @return The SSH identification message which is typically the content of this message
155
    std::string getIdentificationMessage() const;
156
157
    /// @struct SerializedFields
158
    /// Fields written by SSHIdentificationMessage's serializeLayer(), in addition to
159
    /// SSHLayer::SerializedFields.
160
    struct SerializedFields : SSHLayer::SerializedFields
161
    {
162
      /// @return All field descriptors for SSHIdentificationMessage
163
      static std::vector<FieldDescriptor> all()
164
0
      {
165
0
        auto result = SSHLayer::SerializedFields::all();
166
0
        std::initializer_list<FieldDescriptor> extra{ IdentificationMessage };
167
0
        std::copy(extra.begin(), extra.end(), std::back_inserter(result));
168
0
        return result;
169
0
      }
170
171
      /// @brief The identification string, e.g. "SSH-2.0-OpenSSH_5.3"
172
      static const FieldDescriptor IdentificationMessage;
173
174
      // cppcheck-suppress duplInheritedMember
175
      /// Maximum field ID used by the layer.
176
      static constexpr uint16_t MaxID = SSHLayer::SerializedFields::MaxID + 1;
177
    };
178
179
    /// A static method that takes raw data and tries to parse it as an SSH identification message using the
180
    /// heuristics described in the SSHLayer.h file description. It returns a SSHIdentificationMessage instance if
181
    /// such a message can be identified or nullptr otherwise.
182
    /// @param[in] data A pointer to the raw data
183
    /// @param[in] dataLen Size of the data in bytes
184
    /// @param[in] prevLayer A pointer to the previous layer
185
    /// @param[in] packet A pointer to the Packet instance where layer will be stored in
186
    /// @return An instance of SSHIdentificationMessage or nullptr if this is not an identification message
187
    static SSHIdentificationMessage* tryParse(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet);
188
189
    // implement abstract methods
190
191
    /// @return The size of the identification message
192
    size_t getHeaderLen() const override
193
0
    {
194
0
      return m_DataLen;
195
0
    }
196
197
    std::string toString() const override;
198
199
  protected:
200
    void serializeLayer(ObjectScope& serializer) const override;
201
202
  private:
203
    // this layer supports only parsing
204
    SSHIdentificationMessage();
205
206
    // private c'tor, this class cannot be instantiated
207
    SSHIdentificationMessage(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet)
208
0
        : SSHLayer(data, dataLen, prevLayer, packet)
209
0
    {}
210
  };
211
212
  /// @class SSHHandshakeMessage
213
  /// A class representing all of the non-encrypted SSH handshake messages.
214
  /// An handshake message typically has the following structure:
215
  ///
216
  /// @code{.unparsed}
217
  /// 0         1         2         3         4         5         6
218
  /// +---------+---------+---------+---------+---------+---------+-----------     ---------+
219
  /// |            Packet Length              | Padding | Message |  Message  ....  Padding |
220
  /// |                                       | Length  |  Type   |  Content  ....          |
221
  /// +---------------------------------------+---------+---------+-----------     ---------+
222
  /// @endcode
223
  ///
224
  /// The first 4 bytes hold the packet length, followed by 1 byte that holds the padding length (which comes at the
225
  /// end of the message), then 1 byte that holds the message type (which can be of type
226
  /// SSHHandshakeMessage#SSHHandshakeMessageType) and then the message content. At the end of the content there is
227
  /// typically padding.
228
  ///
229
  /// This class provides access to all of these values. The message content itself is not parse with the exception of
230
  /// SSHKeyExchangeInitMessage
231
  /// which inherits from this class and provides parsing of the Key Exchange Init message.
232
  class SSHHandshakeMessage : public SSHLayer
233
  {
234
  public:
235
    /// An enum that represents SSH non-encrypted message types
236
    enum SSHHandshakeMessageType
237
    {
238
      /// Key Exchange Init message
239
      SSH_MSG_KEX_INIT = 20,
240
      /// New Keys message
241
      SSH_MSG_NEW_KEYS = 21,
242
      /// Diffie-Hellman Key Exchange Init message
243
      SSH_MSG_KEX_DH_INIT = 30,
244
      ///  message
245
      SSH_MSG_KEX_DH_REPLY = 31,
246
      /// Diffie-Hellman Group Exchange Init message
247
      SSH_MSG_KEX_DH_GEX_INIT = 32,
248
      /// "Diffie-Hellman Group Exchange Reply message
249
      SSH_MSG_KEX_DH_GEX_REPLY = 33,
250
      /// Diffie-Hellman Group Exchange Request message
251
      SSH_MSG_KEX_DH_GEX_REQUEST = 34,
252
      /// Unknown message
253
      SSH_MSG_UNKNOWN = 999
254
    };
255
256
    /// @return The message type
257
    SSHHandshakeMessageType getMessageType() const;
258
259
    /// @return A string representation of the message type
260
    std::string getMessageTypeStr() const;
261
262
    /// @return A raw byte stream of the message content
263
    uint8_t* getSSHHandshakeMessage() const;
264
265
    /// @return The message content length in [bytes] which is calculated by the overall packet length
266
    /// minus the message header (which includes packet length, padding length and message type) and
267
    /// minus the padding bytes
268
    size_t getSSHHandshakeMessageLength() const;
269
270
    /// @return The padding length in [bytes]
271
    size_t getPaddingLength() const;
272
273
    /// @struct SerializedFields
274
    /// Fields written by SSHHandshakeMessage's serializeLayer(), in addition to
275
    /// SSHLayer::SerializedFields.
276
    struct SerializedFields : SSHLayer::SerializedFields
277
    {
278
      /// @return All field descriptors for SSHHandshakeMessage
279
      static std::vector<FieldDescriptor> all()
280
0
      {
281
0
        auto result = SSHLayer::SerializedFields::all();
282
0
        std::initializer_list<FieldDescriptor> extra{ SSHHandshakeMessageType, SSHHandshakeMessageTypeName,
283
0
                                                    PaddingLength, MessageLength };
284
0
        std::copy(extra.begin(), extra.end(), std::back_inserter(result));
285
0
        return result;
286
0
      }
287
288
      /// @brief The handshake message type as a number, e.g. 20 for Key Exchange Init
289
      static const FieldDescriptor SSHHandshakeMessageType;
290
291
      /// @brief The handshake message type as a string, e.g. "Key Exchange Init"
292
      static const FieldDescriptor SSHHandshakeMessageTypeName;
293
294
      /// @brief Padding length, in bytes
295
      static const FieldDescriptor PaddingLength;
296
297
      /// @brief Message content length, in bytes (excluding header and padding)
298
      static const FieldDescriptor MessageLength;
299
300
      // cppcheck-suppress duplInheritedMember
301
      /// Maximum field ID used by the layer.
302
      static constexpr uint16_t MaxID = SSHLayer::SerializedFields::MaxID + 4;
303
    };
304
305
    /// A static method that takes raw packet data and uses some heuristics described in the
306
    /// SSHLayer.h file description to parse it as SSH handshake message instance
307
    /// @param[in] data A pointer to the raw data
308
    /// @param[in] dataLen Size of the data in bytes
309
    /// @param[in] prevLayer A pointer to the previous layer
310
    /// @param[in] packet A pointer to the Packet instance where layer will be stored in
311
    /// @return Upon successful parsing the return value would be an instance of SSHKeyExchangeInitMessage
312
    /// for Key Exchange Init message or SSHHandshakeMessage for any other message type. If parsing fails nullptr
313
    /// will be returned
314
    static SSHHandshakeMessage* tryParse(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet);
315
316
    // implement abstract methods
317
318
    /// @return The size of the SSH handshake message including the padding and message header
319
    size_t getHeaderLen() const override;
320
321
    std::string toString() const override;
322
323
  protected:
324
#pragma pack(push, 1)
325
    /// An internal struct representing the SSH handshake message header
326
    struct ssh_message_base
327
    {
328
      uint32_t packetLength;
329
      uint8_t paddingLength;
330
      uint8_t messageCode;
331
    };
332
#pragma pack(pop)
333
    static_assert(sizeof(ssh_message_base) == 6, "ssh_message_base size is not 6 bytes");
334
335
    // this layer supports only parsing
336
    SSHHandshakeMessage();
337
338
    // private c'tor, this class cannot be instantiated
339
    SSHHandshakeMessage(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet)
340
0
        : SSHLayer(data, dataLen, prevLayer, packet)
341
0
    {}
342
343
    void serializeLayer(ObjectScope& serializer) const override;
344
345
    ssh_message_base* getMsgBaseHeader() const
346
0
    {
347
0
      return reinterpret_cast<ssh_message_base*>(m_Data);
348
0
    }
349
  };
350
351
  /// @class SSHKeyExchangeInitMessage
352
  /// A class representing the SSH Key Exchange Init message. This is a non-encrypted message that contains
353
  /// information about the algorithms used for key exchange, encryption, MAC and compression. This class provides
354
  /// methods to access these details
355
  class SSHKeyExchangeInitMessage : public SSHHandshakeMessage
356
  {
357
  public:
358
    /// A c'tor for this class that accepts raw message data. Please avoid using it as it's used internally
359
    /// when parsing SSH handshake messages in SSHHandshakeMessage#tryParse()
360
    /// @param[in] data A pointer to the raw data
361
    /// @param[in] dataLen Size of the data in bytes
362
    /// @param[in] prevLayer A pointer to the previous layer
363
    /// @param[in] packet A pointer to the Packet instance where layer will be stored in
364
    SSHKeyExchangeInitMessage(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet);
365
366
    /// Each SSH Key Exchange Init message contains a random 16-byte value generated by the sender.
367
    /// This method returns a pointer to this 16-byte cookie. To get the value as a hex string
368
    /// please refer to getCookieAsHexStream()
369
    /// @return A pointer to the 16-byte cookie value or nullptr if the message is malformed
370
    uint8_t* getCookie() const;
371
372
    /// Each SSH Key Exchange Init message contains a random 16-byte value generated by the sender.
373
    /// This method returns the 16-byte cookie as a hex stream. To get the raw data please refer to
374
    /// getCookie()
375
    /// @return A hex stream of the 16-byte cookie value or an empty string if the message is malformed
376
    std::string getCookieAsHexStream() const;
377
378
    /// @return A comma-separated list of the key exchange algorithms used in this session.
379
    /// Can be empty if the value is missing or the message is malformed
380
    std::string getKeyExchangeAlgorithms() const
381
0
    {
382
0
      return getFieldValue(0);
383
0
    }
384
385
    /// @return A comma-separated list of the algorithms supported for the server host key.
386
    /// Can be empty if the value is missing or the message is malformed
387
    std::string getServerHostKeyAlgorithms() const
388
0
    {
389
0
      return getFieldValue(1);
390
0
    }
391
392
    /// @return A comma-separated list of acceptable symmetric encryption algorithms (also known as ciphers)
393
    /// from the client to the server. Can be empty if the value is missing or the message is malformed
394
    std::string getEncryptionAlgorithmsClientToServer() const
395
0
    {
396
0
      return getFieldValue(2);
397
0
    }
398
399
    /// @return A comma-separated list of acceptable symmetric encryption algorithms (also known as ciphers)
400
    /// from the server to the client. Can be empty if the value is missing or the message is malformed
401
    std::string getEncryptionAlgorithmsServerToClient() const
402
0
    {
403
0
      return getFieldValue(3);
404
0
    }
405
406
    /// @return A comma-separated list of acceptable MAC algorithms from the client to the server.
407
    /// Can be empty if the value is missing or the message is malformed
408
    std::string getMacAlgorithmsClientToServer() const
409
0
    {
410
0
      return getFieldValue(4);
411
0
    }
412
413
    /// @return A comma-separated list of acceptable MAC algorithms from the server to the client.
414
    /// Can be empty if the value is missing or the message is malformed
415
    std::string getMacAlgorithmsServerToClient() const
416
0
    {
417
0
      return getFieldValue(5);
418
0
    }
419
420
    /// @return A comma-separated list of acceptable compression algorithms from the client to the server.
421
    /// Can be empty if the value is missing or the message is malformed
422
    std::string getCompressionAlgorithmsClientToServer() const
423
0
    {
424
0
      return getFieldValue(6);
425
0
    }
426
427
    /// @return A comma-separated list of acceptable compression algorithms from the server to the client.
428
    /// Can be empty if the value is missing or the message is malformed
429
    std::string getCompressionAlgorithmsServerToClient() const
430
0
    {
431
0
      return getFieldValue(7);
432
0
    }
433
434
    /// @return A comma-separated list of language tags from the client to the server.
435
    /// Can be empty if the value is missing or the message is malformed
436
    std::string getLanguagesClientToServer() const
437
0
    {
438
0
      return getFieldValue(8);
439
0
    }
440
441
    /// @return A comma-separated list of language tags from the server to the client.
442
    /// Can be empty if the value is missing or the message is malformed
443
444
    std::string getLanguagesServerToClient() const
445
0
    {
446
0
      return getFieldValue(9);
447
0
    }
448
449
    /// @return Indicates whether a guessed key exchange packet follows. If a
450
    /// guessed packet will be sent, the return value is true. If no guessed
451
    /// packet will be sent or if this value is missing, the return value is false.
452
    bool isFirstKexPacketFollows() const;
453
454
    /// @struct SerializedFields
455
    /// Fields written by SSHKeyExchangeInitMessage's serializeLayer(), in addition to
456
    /// SSHHandshakeMessage::SerializedFields.
457
    struct SerializedFields : SSHHandshakeMessage::SerializedFields
458
    {
459
      /// @return All field descriptors for SSHKeyExchangeInitMessage
460
      static std::vector<FieldDescriptor> all()
461
0
      {
462
0
        auto result = SSHHandshakeMessage::SerializedFields::all();
463
0
        std::initializer_list<FieldDescriptor> extra{ Cookie,
464
0
                                                    KeyExchangeAlgorithms,
465
0
                                                    ServerHostKeyAlgorithms,
466
0
                                                    EncryptionAlgorithmsClientToServer,
467
0
                                                    EncryptionAlgorithmsServerToClient,
468
0
                                                    MacAlgorithmsClientToServer,
469
0
                                                    MacAlgorithmsServerToClient,
470
0
                                                    CompressionAlgorithmsClientToServer,
471
0
                                                    CompressionAlgorithmsServerToClient,
472
0
                                                    LanguagesClientToServer,
473
0
                                                    LanguagesServerToClient,
474
0
                                                    FirstKexPacketFollows };
475
0
        std::copy(extra.begin(), extra.end(), std::back_inserter(result));
476
0
        return result;
477
0
      }
478
479
      /// @brief The 16-byte cookie value as a hex stream
480
      static const FieldDescriptor Cookie;
481
      /// @brief Comma-separated list of key exchange algorithms
482
      static const FieldDescriptor KeyExchangeAlgorithms;
483
      /// @brief Comma-separated list of server host key algorithms
484
      static const FieldDescriptor ServerHostKeyAlgorithms;
485
      /// @brief Comma-separated list of encryption algorithms, client to server
486
      static const FieldDescriptor EncryptionAlgorithmsClientToServer;
487
      /// @brief Comma-separated list of encryption algorithms, server to client
488
      static const FieldDescriptor EncryptionAlgorithmsServerToClient;
489
      /// @brief Comma-separated list of MAC algorithms, client to server
490
      static const FieldDescriptor MacAlgorithmsClientToServer;
491
      /// @brief Comma-separated list of MAC algorithms, server to client
492
      static const FieldDescriptor MacAlgorithmsServerToClient;
493
      /// @brief Comma-separated list of compression algorithms, client to server
494
      static const FieldDescriptor CompressionAlgorithmsClientToServer;
495
      /// @brief Comma-separated list of compression algorithms, server to client
496
      static const FieldDescriptor CompressionAlgorithmsServerToClient;
497
      /// @brief Comma-separated list of language tags, client to server
498
      static const FieldDescriptor LanguagesClientToServer;
499
      /// @brief Comma-separated list of language tags, server to client
500
      static const FieldDescriptor LanguagesServerToClient;
501
      /// @brief Whether a guessed key exchange packet follows
502
      static const FieldDescriptor FirstKexPacketFollows;
503
504
      // cppcheck-suppress duplInheritedMember
505
      /// Maximum field ID used by the layer.
506
      static constexpr uint16_t MaxID = SSHHandshakeMessage::SerializedFields::MaxID + 12;
507
    };
508
509
  protected:
510
    void serializeLayer(ObjectScope& serializer) const override;
511
512
  private:
513
    mutable size_t m_FieldOffsets[11];
514
    mutable bool m_OffsetsInitialized;
515
516
    void parseMessageAndInitOffsets() const;
517
518
    std::string getFieldValue(int fieldOffsetIndex) const;
519
  };
520
521
  /// @class SSHEncryptedMessage
522
  /// A class representing an SSH encrypted message. In such messages there is very little information to extract from
523
  /// the packet, hence this class doesn't expose any methods or getters, other than the ones inherited from parent
524
  /// classes.
525
  ///
526
  /// It is assumed that any SSH message which does not fit to any of the other SSH message types, according to the
527
  /// heuristics described in the SSHLayer.h file description, is considered as an encrypted message.
528
  class SSHEncryptedMessage : public SSHLayer
529
  {
530
  public:
531
    /// A c'tor for this class that accepts raw message data. Please avoid using it as it's used internally
532
    /// when parsing SSH messages in SSHLayer#createSSHMessage()
533
    SSHEncryptedMessage(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet)
534
0
        : SSHLayer(data, dataLen, prevLayer, packet)
535
0
    {}
536
537
    // implement abstract methods
538
539
    /// @return The size of the message which is equal to the size of the layer
540
    size_t getHeaderLen() const override
541
0
    {
542
0
      return m_DataLen;
543
0
    }
544
545
    std::string toString() const override;
546
547
  protected:
548
    void serializeLayer(ObjectScope& serializer) const override;
549
  };
550
551
}  // namespace pcpp