That’s law in the UK:
Section 49 of the Regulation of Investigatory Powers Act 2000 gives the police the power to issue a notice which requires the suspect to disclose their PIN or password if necessary. You are not compelled to provide your password to the police in any instance.
However, section 53 of RIPA makes it a criminal offence not to comply with the terms of a s.49 notice which is punishable by up to two years imprisonment and up to 5 years imprisonment in cases involving national security and child indecency.
If the police and/or Crown Prosecution Service claim you’re hiding Material behind a password, you can either hand over the password or get thrown in jail under RIPA §53.
I don’t know what section of the US Code would apply for the same, but a generic “Obstructing Justice” wouldn’t surprise me.