CAL. CIV. CODE § 2772 : California Code - Section 2772

Indemnity is a contract by which one engages to save another from a legal consequence of the conduct of one of the parties, or of some other person. [2773.] Section Twenty-seven Hundred and Seventy-three. An agreement to indemnify a person against an act thereafter to be done, is void, if the act be known by such person at the time of doing it to be unlawful.