A man has been held in prison for seven months after failing to decrypt two hard drives that investigators suspect contain indecent images of children.
A court order says the man will remain jailed "until such time that he fully complies" with an order to unlock the password-protected devices.
The US man, who has not been charged with possessing illegal images, is appealing against his detention.
"He has never in his life been charged with a crime," wrote his lawyer.
The case highlights the US government's ongoing battle with data encryption.
The man, a former police sergeant, cannot be named for legal reasons.
The case so far
In March 2015, investigators in Delaware County, Pennsylvania, seized computer equipment from the man's home, including two password-protected hard drives.
The investigators had been monitoring the online network Freenet and decided to search the man's home, according to news site Ars Technica.
After a district court ruled the man would not be compelled to decrypt the hard drives, investigators took the case to a federal court that issued a warrant to search the devices.
The government then invoked a 1789 law called the All Writs Act, which gives federal courts the power to force people to co-operate in a criminal investigation.
The same law was controversially invoked by the FBI when it tried to compel Apple to decrypt the iPhone used by California gunman Syed Rizwan Farook. Apple said that the demand was a "stretch" of the law.
According to the jailed man's appeal, he appeared at the district attorney's office to enter passcodes for the hard drives - but they failed to work.
He was then ordered to explain his failure to enter the correct passcodes, but after declining to testify was held in contempt of court and jailed.
"His confinement stems from an assertion of his Fifth Amendment privilege against self-incrimination," wrote the man's lawyer, Keith Donoghue.
The US Constitution's Fifth Amendment is designed to protect people from being forced to testify and potentially incriminating themselves and states: "No person shall be... compelled in any criminal case to be a witness against himself."
The Electronic Frontier Foundation, which campaigns for digital rights, said: "Compelled decryption is inherently testimonial because it compels a suspect to use the contents of their mind to translate unintelligible evidence into a form that can be used against them."
The man's appeal also contends that he should not be forced to decrypt the hard drives because the investigators do not know for certain whether indecent images are stored on them.
The EFF agreed: "Complying with the order would communicate facts that are not foregone conclusions already known to the government".
The appeal, which argued the man should be released from prison while it was considered, was filed on 26 April.