Sunday, November 26, 2023

Receipt Validation With All the Ethernet Interfaces

Jeff Johnson:

I’ve recently run into a case that seems to call into question all extant sample code for Mac App Store receipt validation. […] I learned that the ethernet port of the customer’s Mac was fried as a result of electrical damage from a lightning strike. The Mac’s motherboard was replaced, but afterward the customer still couldn’t launch Magnet, and now they couldn’t launch Link Unshortener either. It turns out that the Mac’s ethernet port is now en11 rather than en0. Apple’s old sample code checked only en0, and Apple’s new sample code checks only en0 and en1, so that technique won’t work. And the technique suggested by Chris Liscio won’t work, because querying for kIOPrimaryInterface returned no results! The customer’s Mac reported having no primary ethernet interface.

My solution was to query all built-in ethernet interfaces—in technical terms, kIOBuiltin devices of kIOEthernetInterfaceClass—and attempt to validate each interface’s MAC address with the App Store receipt until a match was found. This might be the same technique suggested by Paulo Andrade, but that blog post contains no sample code.

Previously:

2 Comments RSS · Twitter · Mastodon


Beatrix Willius

What does receipt validation have to do with ethernet ports?


@Beatrix The receipt includes the MAC address so that you can verify not only that that receipt is valid but also that it corresponds to the Mac the app is running on. Each Ethernet port (or other network interface) has its own MAC address.

Leave a Comment