Skip to content

Fmp auth header

fmp_auth_header

Module for encoding and decoding EFI_FIRMWARE_IMAGE_AUTHENTICATION with certificate data and payload data.

FmpAuthHeaderClass

An object representing an EFI_FIRMWARE_IMAGE_AUTHENTICATION.

Can parse or produce an EFI_FIRMWARE_IMAGE_AUTHENTICATION structure/byte buffer.

Attributes:

Name Type Description
MonotonicCount int

It is included in the signature of AuthInfo. It is used to ensure freshness/no replay. It is incremented during each firmware image operation.

AuthInfo WinCertUefiGuid

Provides the authorization for the firmware image operations.

Payload str

string representing payload as bytes (i.e. b'\x01\x00\x03')

FmpPayloadHeader FmpPayloadHeaderClass

Header for the payload

typedef struct {
    UINT64                                  MonotonicCount;
    WIN_CERTIFICATE_UEFI_GUID               AuthInfo;
} EFI_FIRMWARE_IMAGE_AUTHENTICATION;

__init__

__init__() -> FmpAuthHeaderClass

Inits an empty object.

Encode

Encode() -> bytes

Serializes the Auth header + AuthInfo + Payload/FmpPayloadHeader.

Returns:

Type Description
bytes

string representing packed data as bytes (i.e. b'\x01\x00\x03')

Decode

Decode(Buffer: IO) -> bytes

Loads data into the Object by parsing a buffer.

Parameters:

Name Type Description Default
Buffer obj

Buffer containing the data

required

Returns:

Type Description
str

string of binary representing the payload

Raises:

Type Description
ValueError

Invalid Buffer

IsSigned

IsSigned(Buffer: IO) -> bool

Parses the buffer and returns if the Cert is signed or not.

Returns:

Type Description
bool

True if signed

bool

False if invalid buffer

bool

False if not signed

DumpInfo

DumpInfo() -> None

Prints object to console.