Is forcing the revelation of a passcode more akin to speech, or is it more akin to providing a physical key?
The former is currently illegal, but being challenged in many jurisdictions. The latter is legal.
Thus the simultaneous push for Apple and others to provide back-doors. And large sums of money paid by the FBI to Israeli(?) IT firms to crack phones.