IANAL but it depends. In the US there is strong protection for the contents of your mind and self-incrimination. So if your keys were locked behind a strong password the legal system wouldn't be able to access it. But if you had no password they would be able to seize the device and read the messages.
So basically if the messages are inaccessible other than a secret that you know them yes, they wouldn't be forced to reveal it.