Providing the combination to your safe seems like a closer analogy, and I believe it is protected from compulsion by the Fifth Amendment.
An encrypted file cannot, assuming a suitably complex password.
So require proof that the file is not decryptable by other means before you can compel entering a password ;)
You can’t take the fifth before a grand jury. I think there is a certain presumption that the actors are gentlemen that the law assumes. If you feel really strongly about that sort of privacy, you’d be well served to not find yourself in a criminal court trial.
There is both ambiguity and case law here.