EFI
application/octet-stream
Magic Bytes
Offset: 0
4D 5A
The Extensible Firmware Interface (EFI) is a binary executable format originally developed by Intel and now managed by the Unified EFI Forum. It is primarily used to facilitate system booting, hardware initialization, and diagnostic procedures within the modern Unified Extensible Firmware Interface (UEFI) environment. To ensure platform integrity, these files are frequently digitally signed to meet Secure Boot requirements, which prevents unauthorized code from executing during the computer’s initial pre-boot sequence.
Validation Code
How to validate .efi files in Python
Python
def is_efi(file_path: str) -> bool:
"""Check if file is a valid EFI by magic bytes."""
signature = bytes([0x4D, 0x5A])
with open(file_path, "rb") as f:
return f.read(2) == signature
How to validate .efi files in Node.js
Node.js
function isEFI(buffer: Buffer): boolean {
const signature = Buffer.from([0x4D, 0x5A]);
return buffer.subarray(0, 2).equals(signature);
}
Go
func IsEFI(data []byte) bool {
signature := []byte{0x4D, 0x5A}
if len(data) < 2 {
return false
}
return bytes.Equal(data[:2], signature)
}
API Endpoint
GET
/api/v1/efi
curl https://filesignature.org/api/v1/efi