| There are two issues: 1) Does the Fifth Amendment apply? 2) Does the Fifth Amendment prohibit certain things? The Fifth Amendment, like the others, generally applies to not just citizens, but legal residents and others who are on U.S. soil. The second issue is what's interesting here. The literal text of the Fifth Amendment is: "No person... shall be compelled in any criminal case to be a witness against himself." Literally, it prohibits people from being forced to testify against themselves in a criminal trial. The Supreme Court has ready it very broadly to prohibit all sorts of other things, but one limit it has recognized is that it still only applies to "testimonial" incrimination. Think: testifying on a witness stand. Non-testimonial acts, like forcing someone to unlock a box, are not covered. Some courts have held, and the EFF argues, that providing an encryption key is unlike providing the key for a box because it requires you to recount things that are in your memory, and is therefore testimonial. |
(IANAL) The example is not 100% applicable. You can only be legally compelled to open a lockbox if doing so provides no testimonial information. If there is uncertainty around whether you had control over the contents of the lockbox, then opening it would definitely provide that information. This action is therefore considered to have a testimonial component, and covered by the 5th Amendment.
You can still be compelled to open the lockbox, if doing so will not run afoul of the 5th Amendment. There are generally two ways to do so. One is that the action does not have a (non-trivial) testimonial component: If there is no doubt that you had control over the contents of the lockbox, then there is effectively no information being provided. The second way is that the testimonial component is not used against you: the prosecution cannot say that you opened it, but is otherwise allowed to use the contents as evidence (with caveats).