When purchasing a used iPhone with a completely unknown history (which includes the possibility of multiple previous owners), is it possible to reset it and be sure that all software and firmware on it is 100% identical to the factory image?
Please keep in mind that since the history is unknown, it's possible the device was previously jailbroken/unlocked/rooted/etc.
If the answer varies depending on iPhone model, please indicate to which models your answer pertains.
I'm interested in answers for all iPhone models.
Please note: The question and answers at Is it possible to return the iPhone to its very original factory state? do not help because they do not take in account the possibility of the phone being jailbroken/unlocked/rooted/etc. Also, that question is ambiguous as to whether or not it applies to both the software and firmware.