AH - Authentication Header

pcapkit.protocols.internet.ah contains AH only, which implements extractor for Authentication Header (AH) *, whose structure is described as below:

Octets

Bits

Name

Description

0

0

ah.next

Next Header

1

8

ah.length

Payload Length

2

16

Reserved (must be zero)

4

32

sah.spi

Security Parameters Index (SPI)

8

64

sah.seq

Sequence Number Field

12

96

sah.icv

Integrity Check Value (ICV)


class pcapkit.protocols.internet.ah.AH(file=None, length=None, **kwargs)[source]

Bases: pcapkit.protocols.internet.ipsec.IPsec

This class implements Authentication Header.

classmethod __index__()[source]

Numeral registry index of the protocol.

Returns

Numeral registry index of the protocol in IANA.

Return type

pcapkit.const.reg.transtype.TransType

__length_hint__()[source]

Return an estimated length for the object.

Return type

Literal[20]

__post_init__(file, length=None, *, version=4, extension=False, **kwargs)[source]

Post initialisation hook.

Parameters
  • file (io.BytesIO) – Source packet stream.

  • length (Optional[int]) – Length of packet data.

Keyword Arguments
  • version (Literal[4, 6]) – IP protocol version.

  • extension (bool) – If the protocol is used as an IPv6 extension header.

  • **kwargs – Arbitrary keyword arguments.

See also

For construction argument, please refer to make().

classmethod id()[source]

Index ID of the protocol.

Returns

Index ID of the protocol.

Return type

Literal[‘AH’]

make(**kwargs)[source]

Make (construct) packet data.

Keyword Arguments

**kwargs – Arbitrary keyword arguments.

Returns

Constructed packet data.

Return type

bytes

read(length=None, *, version=4, extension=False, **kwargs)[source]

Read Authentication Header.

Structure of AH header [RFC 4302]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header   |  Payload Len  |          RESERVED             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                 Security Parameters Index (SPI)               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    Sequence Number Field                      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                Integrity Check Value-ICV (variable)           |
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters

length (Optional[int]) – Length of packet data.

Keyword Arguments
  • version (Literal[4, 6]) – IP protocol version.

  • extension (bool) – If the protocol is used as an IPv6 extension header.

  • **kwargs – Arbitrary keyword arguments.

Returns

Parsed packet data.

Return type

DataType_AH

property length

Info dict of current instance.

Return type

int

property name

Name of corresponding protocol.

Return type

Literal[‘Authentication Header’]

property payload

Payload of current instance.

Raises

UnsupportedCall – if the protocol is used as an IPv6 extension header

Return type

pcapkit.protocols.protocol.Protocol

property protocol

Name of next layer protocol.

Return type

pcapkit.const.reg.transtype.TransType

Data Structure

Important

Following classes are only for documentation purpose. They do NOT exist in the pcapkit module.

class pcapkit.protocols.internet.ah.DataType_AH
Bases

TypedDict

Authentication header [RFC 4302].

next: pcapkit.const.reg.transtype.TransType

Next header.

length: int

Payload length.

spi: int

Security parameters index (SPI).

seq: int

Sequence number field.

icv: int

Integrity check value (ICV).


*

https://en.wikipedia.org/wiki/IPsec