Thank you Quinn, this is helpful. I just read up the contents of the header file you note and the comments on those fields are clear.
So I suspect that the Mac doing the signing has a clock that’s way of sync with reality, so these two values end up significantly different, and thus this problem.
I read through the linked TN3161: Inside Code Signing: Certificates | Apple Developer Documentation and it says that it contacts timestamp.apple.com for getting a secure timestamp. Is there a tool that I could use to directly issue a similar request against that server and see what it returns? That might help us debug this on many of these hosts where this happens intermittently. As far as I can see, there's no option/flag in codesign which would allow us to print verbose logs showing it communicating with the timestamp authority server.
One other question, that doc also says:
Don’t confused the Timestamp and Signed Time fields. The latter is not secured by the Apple timestamp service. Rather, codesign sets this field based on your Mac’s current time.
I think it corresponds to the kSecCodeInfoTime field we are discussing here. Would you happen to know, what API the codesign tool uses in its implementation to obtain the host's current time?
Topic:
Code Signing
SubTopic:
General
Tags: