In the USA can you be compelled to testify against yourself by being coerced into giving a password to law enforcement? Has this been tested yet, out of curiosity? I remember reading they can deny you entry/exit to the USA if customs can't read your laptop but never heard anything like local/FBI. If not, I hope it doesn't go before this particular supreme court.
They can slap an "obstruction of justice" charge on. Or charge you with "contempt of court" and just jail you based on that. In broader terms yes the system has a way to inflict random punishment on you for disobidience. In other countries they will just start breaking your fingers, your loved ones fingers, and so on. So the password problem is solved a lot "easier" then.
Obstruction of justice can only be committed by officers of the court or elected officials.
> Or charge you with "contempt of court" and just jail you based on that.
This seems very unlikely given the (1) the 5th amendment and (2) only judges can issue contempt of court citations.