## 3 Challenges and Our Approach  
In this section we describe, in more detail, the main challenges that need to be taken into account in order to add security to WSNs and to dynamically (re)configure the security level at runtime. We also indicate how our approach copes with these challenges. Challenge1: Build secure applications that run on heterogeneous nodes with limited capabilities. The nodes of the WSNs are heterogeneous, and thus, the security solution deployed at each node needs to be adapted to the characteristics of every node. Furthermore, these nodes have limited capabilities,  
Figure 3: A context speed advisory (CSA) scenario. and the security solutions need to be carefully specified to avoid consuming too many resources. This means that we need to define a family of security solutions, providing different implementations for the different nodes in the WSN, while also taking into account the constraints on the resources available for each node. Our approach: Using the software product line mechanisms, already existing in the development process defined as part of FamiWare, we will be able to generate customized instances of the FamiWare middleware, each one ready to be run on a specific node of the WSN. In this way, every instance of FamiWare has just the security services or algorithms required by the applications installed in each node. Therefore, we avoid loading a big chunk of security code into the limited tiny devices. We will integrate the new security components defined by INTER-TRUST as part of the FamiWare product line architecture. Challenge2: Dynamic negotiation of security policies for WSNs. The conditions of the running environment of the WSNs applications could change. Then, the security policies may need to be adapted to the new conditions. This adaptation requires a previous negotiation between the different parts of the application. Our approach: As previously said, INTER-TRUST is the only framework that provides dynamic negotiation of security policies. By integrating the INTER-TRUST framework with FamiWare, we provide a middleware that allows the dynamic negotiation of the security policies for the sensor nodes already included as part of FamiWare. Challenge3: Monitor the changes in the context. These changes can be general (e.g., changes in the amount of memory or the battery level available) or can be specific to security. In order to react to these changes, the environment needs to be monitored. Our approach: Both INTER-TRUST framework and FamiWare middleware include specific components for monitoring the environment. Therefore, we will add those security components provided by INTER-TRUST that are not present in FamiWare. The main contribution of the process proposed here is to guarantee that among all of the existing monitoring components, only the most necessary and appropriate ones are incorporated into the solution for each sensor node. This is done via the configuration process provided by FamiWare. Challenge4: Define a dynamic reconfiguration service to endow applications with self-protection. When the environment or the security requirements change at runtime, the system must be self-protected to maintain a proper and secure functioning. Our approach: Firstly, the new security policies to be used need to be negotiated using INTER-TRUST. Secondly, the new security policy needs to be analyzed to determine whether the changes to the security policy imply changes in the system's components. If changes in the system's components are required, then a reconfiguration plan needs to be generated to carry out these changes without stopping or crashing the system. The last two tasks are performed by FamiWare. These plans contain the implementation level activities to be carried out in order to instantiate the new security policies. Challenge5: Provide an efficient solution able to run on a WSN. As WSNs are composed of a large number of tiny devices, the self-protection mechanism should consume the least number of resources as possible.