Yes, they can. If the judge has reasonable grounds to believe that you are withholding evidence or the knowledge necessary for law enforcement to collect this evidence then the judge can hold you in contempt of court and place you in jail until you agree to provide the information. While there have been a couple of aberrations in the general flow of case law to a standard consensus on the matter, the general consensus (at least at the federal level) is that being compelled to provide an encryption key is not covered by the 5th amendment's protection against self-incrimination.