I was reading the EFF’s article on your rights to prevent the searching of your digital devices. One of the paradoxes here is that the Fifth amendment covers you if revealing your password or encryption key will incriminate you, and even a court is unlikely to be able to compel you to do that. But if the search is not for something that would incriminate you, they could compel you to release your keys.
However, the Three Felonies a Day guy says that the laws are so complex and cover so much that the average person commits 3 felonies a day. Seems to me that you could make the case that revealing your password and crypto keys would almost certainly incriminate you, without having to incriminate yourself with saying what the crime would be.
However, border crossings are an exception, they can search your electronics without a warrant or probable cause.
In any case, you should never say anything to the police without your lawyer present.