iCloud activation is not stored locally. When an iPhone turns on, it sends its EID, IMEI, and Serial Number to Apple's activation server ( albert.apple.com ). The server responds with a "Activation Record." A custom IPSW cannot fake this response because the request is encrypted with a certificate rooted in the device's hardware (GID key). You cannot extract the GID key without advanced micro-soldering and glitching attacks.
This is the . Services like OfficialiPhoneUnlock, DoctorUnlock, or TheUnlockBox use internal carrier or Apple enterprise certificates to remove the lock from Apple's database via the IMEI number.
If you are attempting to use a custom IPSW, verify the device's first. An "IMEI Clean" status is sometimes recoverable via official Apple support channels if proof of purchase is provided, which is the only 100% permanent and legal unlock method.