== How do I use CCP security? == The following is a simple example of how to set up a model with [[CAN Calibration Protocol|CCP]] security. This example uses PiSnoop as the calibration tool. First, include in your model a [[doc_user/openecu_user_guide_simulink_chunk/pcp_ccp_security.html|pcp_CCPSecurity]] block: {{attachment:ccp_sec_1.png}} {{{key_validator}}} is the name of the key validator function and is described in detail in the [[doc_user/openecu_user_guide_c_api/openecu_user_guide_c_api.html#ccp_seed_key_security_key_validator|user guide]]. Here is the complete source code for key_validator.c: {{{ #include "openecu.h" BOOL key_validator(const U8 privilege_level, const U8 *const seed, const U8 *const key, const U8 key_size) { /* Ignore key_size, get 6 bytes in CCP v2.1 but only 4 typically relevant */ return (seed[0] == key[3] && seed[1] == key[2] && seed[2] == key[1] && seed[3] == key[0] ); } }}} In the model, this file will need to be added as custom code; e.g. in R2008b: {{attachment:ccp_sec_6.png}} In PiSnoop, the workspace will need to be set up so that the CCP protocol has the seed/key enabled, e.e. using the 'own code' security option like this: {{attachment:ccp_sec_2.png}} {{attachment:ccp_sec_3.png}} {{attachment:ccp_sec_4.png}} {{attachment:ccp_sec_5.png}} There is more on that in the [[http://www.pi-innovo.com/assets/softwares/public/PiSnoop/LatestHelp/snoop_help_seed_key.htm|PiSnoop Documentation]]. Doing all this, one can modify calibrations and reflash, but only with security turned on. For further information, see the [[doc_user/openecu_user_guide_c_api/openecu_user_guide_c_api.html#ccp_seed_key_security_overview|user guide]]. If you have further questions, feel free to [[OpenECU Support Contact|contact OpenECU support]].