There is no way someone can be put in jail for writing a book. Unless it contained libel, or violated copyrights, or maybe even if it treasonously contained classified government information like nuclear secrets, then writing a book falls under freedom of speech.
Would be nice if this was still true. But under current laws, I'd be thrown in jail for publishing a book showing how a common household marker will defeat a certain companies copy protection on their CD, or if I worte about how to protect your internet connection via a NAT device (in certain states). Need proof? Check out the PhD student no longer allowed to publish a thesis paper in Michigan here.