EFF:
First, the compelled entry of a memorized passcode forces a person to reveal the contents of their mind to investigators—contents that are absolutely privileged by the Fifth Amendment. As far as the Fifth Amendment is concerned, there’s no difference between forcing a person to type their passcode directly into their phone and forcing them to say it out loud to an investigator. The trial judge in this case understood that and found that typing in a passcode was a “testimonial act.” So just by forcing the defendant to unlock his phone, the investigators violated his Fifth Amendment right.
Second, the process of decryption itself is testimonial because it involves translating unintelligible, encrypted evidence into a form that can be used and understood by investigators—again relying on the contents of the suspect’s mind.