Exmbus.Parser.Afl (Exmbus v0.4.0)
View SourceAuthentication and Fragmentation Layer (AFL) as per EN 13757-7:2018
The Authentication and Fragmentation Sublayer provides three essential services:
— fragmentation of long messages in multiple datagrams; — a Message Authentication Code (MAC) to prove the authenticity of the TPL and APL; — a Message counter which supplies a security relevant message identification that may be used for the key derivation function (refer to 9.6.1).
This optional layer shall be applied if at least one of these services is required.
Overview of the AFL layer:
| Size (bytes) | Field Name | Description |
|---|---|---|
| 1 | CI | Indicates that an Authentication and Fragmentation Sublayer follows. |
| 1 | AFLL | AFL-Length |
| 2 | FCL | Fragmentation Control field |
| 1 | MCL | Message Control field *a |
| 2 | KI | Key Information field *a |
| 4 | MCR | Message counter field *a |
| N *b | MAC | Message Authentication Code *a |
| 2 | ML | Message Length field *a |
*aThis is an optional field. Their inclusion is defined by the Fragmentation Control Field specified in 6.3.2.*bThe length of MAC depends on AT-subfield in AFL.MCL.
All multi byte fields of AFL except the AFL.MAC shall be transmitted with least significant byte first (little endian).
Summary
Functions
Returns true if this message is part of a fragmented message.
Parses an AFL and add it to the parse context.
Verifies the MAC of the AFL. NOTE: This handler should be attached after the TPL has been parsed, so that we can use the TPL CF field to determine the key to use.
Parses an AFL and add it to the parse context.
Functions
Returns true if this message is part of a fragmented message.
Parses an AFL and add it to the parse context.
In contrast to parse/1, this function will not fail if the data
doesn't contain an AFL. Instead, it will assign a %None{} struct
to the ell context field.
Verifies the MAC of the AFL. NOTE: This handler should be attached after the TPL has been parsed, so that we can use the TPL CF field to determine the key to use.
Parses an AFL and add it to the parse context.