Whether the government was allowed to compel a company to write and sign code was going to be determined in the "Apple-FBI encryption dispute" but the FBI withdrew the day before the hearing since they had found another way to crack the phone without apple's help. I wonder if this will ever be re-litigated or the government just learned its easier to pay someone to write an exploit than it is to pay a company to write a backdoor.
https://www.eff.org/deeplinks/2016/03/deep-dive-why-forcing-...
https://en.wikipedia.org/wiki/Apple%E2%80%93FBI_encryption_d...