Scan chain encryption for the test, diagnosis and debug of secure circuits