The Fifth Amendment states that no person “shall be compelled in any criminal case to be a witness against himself.”
This is not to say that physical evidence such as diaries and other documents are not admissible in court against their authors. Quite the contrary, such evidence is not only admissible, but over the years the courts have ruled that an author may be compelled to surrender such evidence, even if such evidence is incriminating. But, what the courts have taken away by limiting the scope of the Fifth Amendment to exclude physical evidence, technology may be giving back thanks in large to modern cryptography. In a recent federal appeal’s ruling, the court decided that forcing a criminal suspect to decrypt their previously-encrypted hard drives so that their contents can be used by prosecutors is a breach of the Fifth Amendment right against compelled self-incrimination. This “question” is not settled by any means; at least one other federal appeal ruling by a different court on a different case under slightly different circumstances have come out with an opposite opinion, suggesting that in all likelihood this question will be revisited by the Supreme Court at some point in the future.