It will never be possible to deal with that situation.
Its also why many governments have taken to locking people up until they give up their passwords.
Its a scenario that has been immortalised in the famous XKCD wrench conundrum: https://xkcd.com/538/
The only real way to deal with it is to get away from the situation and remote wipe (or hope they type in your password wrong N times so local wipe happens)