Format:Mach-O/Encryption info
LC_ENCRYPTION_INFO and LC_ENCRYPTION_INFO_64: field layout and how to recognize an encrypted (cryptid 1) binary. Recognition only.
Layout
LC_ENCRYPTION_INFO (0x21) is encryption_info_command: cmd, cmdsize, cryptoff (file offset of the encrypted range), cryptsize (its size), cryptid (encryption system id). LC_ENCRYPTION_INFO_64 (0x2C) adds a trailing pad uint32 so the structure is a multiple of 8 bytes. Fields are uint32 in the file's byte order.
What cryptid means
cryptid 0 means the range is not encrypted. A non-zero value (1 for Apple's App Store protection) means the bytes from cryptoff for cryptsize are encrypted on disk, normally the __TEXT pages from the end of the header and load commands onward. The header comment of loader.h only states the zero case. The encryption system is Apple's FairPlay; this wiki documents recognition only.
Recognizing an encrypted binary
- Walk the load commands of each fat slice and look for cmd 0x21 or 0x2C.
- Read
cryptid. 1 plus a non-zerocryptsizemeans encrypted. - Symptoms of an encrypted slice: the header, load commands and the segments outside the range (
__DATA,__LINKEDIT, symbols and the chained fixups) parse normally, but__textis high-entropy and disassembles as noise, and string sections inside the range look random. - Apps built for the Mac App Store, TestFlight/sideloaded development builds and system binaries normally have cryptid 0 or no such command. Unverified: exact distribution of cryptid by channel.
Tools that report it: the LIEF Mach-O parser exposes EncryptionInfo, and otool -l prints cryptid. Do not rely on the encrypted range for analysis; use other evidence (imports, the unencrypted metadata, the bundle's other files).
Parent: Format:Mach-O. Related: Format:Mach-O/Load commands, Platform:IOS, Format:IPA.