China has said it acted “in accordance with the law” over the execution of four Canadian citizens in recent weeks.