I draw the line using a “rag doll” model. They can compel fingerprints, physical keys, DNA, etc. insofar as they can manipulate your limp unresitive (albeit uncooperative) body to take fingerprints, extract keys from pockets, snip a hair, extract a blood sample, etc. They cannot, however, compel you to act on their behalf and against your own interests - to wit, they cannot demand you speak (type, write, press buttons) words the whole point of which can and will be used against you. If they can find the password, fine; if it exists only in your head, no.
“Rubber hose cryptology” (to wit: threaten you with harm unless you confess the keyword) is not an acceptable legal tool.
I like your “rag doll” analogy. I think you’re on to something there. The court can allow the state to inspect, search, and take things— even as you say with fingerprints and DNA. But that logic does not extend to compelling a defendant or witness to say anything. I can’t think of any other example of somebody being forced to say or write some specific thing.