Alright, this is making me crazy, so I take a deep breath and try to simplify manually...
$TIME = dechex(1673481600000); /* Today in ms */
$EXPIRY = dechex(1676160000000); /* Expiry in ms ($TIME + 30 days) */
/* For the encodedTimeString */
$data['encodedTimeString'] = "0x" . applyToValue($TIME, $private_keys['private_key_part1'], $private_keys['private_key_part2']);
/* For the XML containing the $EXPIRY (among the other things) */
$root->setAttribute("expiryTime", $EXPIRY);
$root->setAttribute("expiring_mach", $MACHINE);
$ENCRYPTED_XML = "#" . applyToValue($XML_STRING, $private_keys['private_key_part1'], $private_keys['private_key_part2']);
Result from unlocker.checkExpirationData(encodedTimeString) => Unlocked with19400 days remaining
I'm just lost...