Typically ignorance of the law is not an excuse when found disobeying it, and there are more laws than any reasonable person can know.
Knowledge of the act, not knowledge of the law. There are very few contexts in which you can be punished for not knowing an illegal act took place, and they are all situations where you should have known but were negligent.