Here’s an interesting discussion of whether you can be compelled to provide a password.
http://boards.straightdope.com/sdmb/showthread.php?t=580986
From a practical perspective, all they can do is imprison you, I presume for contempt of court, until you do give up the password. If doing so would provide evidence sufficient to convict you of a really serious crime, possibly a capital one, I find it difficult to see what incentive the accused would have to do so, regardless of what a court may order.
I’m not seeing where an indefinite prison term is any better than a definite one. ;)
More seriously, in true capital cases, the prosecutors most likely have a pretty good circumstantial case against you to start with, or they wouldn’t even know about the documents you’re refusing to turn over. Things also get a little murky about how much defense you can offer when you take the 5th, that is, how limited the scope of the claim is and what that means you yourself cannot discuss without waiving that claim. Add on to that the negative inference the jury will make, regardless of any pro forma instructions otherwise, about your refusal to turn over the documents.
So when you are convicted, your refusal to cooperate will factor into any sentencing recommendations.
Now, if the only thing having a prayer of standing between you and a lethal injection is your password, sure, you’re not going to give it up. But that doesn’t mean you’re going to skate, either.
I would seriously think the 5th amendment would blatantly apply to this -
you CANNOT BE COMPELLED TO PROVIDE INCRIMINATING INFORMATION TO THE GOV’T.