[ca] Les xarxes sensorials (WSN) s'han tornat populars durant els últims anys. L'aparició de l'IPv6, ampliant l'espai de direccionament, de l'IEEE802.15.4 i de capes d'adaptació com 6loWPAN permeten la intercomunicació de dispositius petits. Aquestes xarxes són útils en escenaris com la monitorizació civil, la mineria o en operacions al camp de batalla; però també per a productes comercials. Per aquest motiu, cal proporcionar solucions de seguretat realitzables que garanteixin privacitat, autenticitat, integritat i actualitat de les dades. A la majoria de casos, els nodes d'una WSN no estan protegits de la manipulació física i tenen reduïts recursos disponibles. Això fa que els sistemes PKI no siguin atractius en aquest entorns. Al mateix temps, la pre-distribució de claus ofereix un nivell de seguretat massa baix per a la majora d'aplicacions. Per aquest motiu, l'establiment de la comunicació segura (o problema de generació i distribució de claus) és una preocupació important que cal abordar en conjunció amb les limitades capacitats dels nodes. En aquesta tesi, es descriu una solució al problema descrit. Es fa ús de ECDH i la corba K-163 per l'intercanvi de claus; d'AES-CCM-128 per al xifrat simètric (el qual minimitza l'overhead de processament); i de cadenes de resolució parcial de reptes conjuntament amb un TAS garantint autenticació forta. Diversos algoritmes de hash i generadors de números aleatoris han estat analitzats. Al mateix temps, per tal d'encaixar la generació i distribució de claus juntament amb la operativa natural d'un sensor, s'ha optimitzat la llibreria criptogràfica Relic-Toolkit, reduint-ne l'impacte de memòria en 4KB; s'ha reduït el requeriment de memòria de Contiki OS permetent-ne l'execució en tan sols 18KB de flash; i s'han desenvolupat drivers per als perifèrics d'un CC430 que han reduït els temps de computació notablement. La solució proposada permet la generació i distribució de claus in-situ i ha demostrat ser resistent a la majoria d'adversaris proposats al mateix temps que s'ha tingut en compte l'escalabilitat, la portabilitat i el consum energètic, fent-la adequada per l'ús en aplicacions comercials.

[en] Wireless Sensor Networks have become popular during the last years. The introduction of IPv6 which broadened the address space available, IEEE802.15.4 and adaptation layers such as 6loWPAN have allowed the intercommunication of small devices. These networks are useful in many scenarios such as civil monitoring, mining, battlefield operations, as well as consumer products. Hence, practical security solutions for the intercommunication must be provided, ensuring privacy, authenticity, integrity and data freshness. In most cases, WSN nodes are not tamper-proof and have very limited available resources and capabilities which makes PKI currently not attractive for this environment. At the same time, key pre-distribution provide too low security for most applications. Therefore, the communication bootstrapping or the key generation and distribution problem is an important concern to be addressed with the additional difficulty of the constrained capabilities of WSN nodes. In this thesis, a solution to this problem is described. It makes use of ECDH and the curve K-163 for key exchange, AES- CCM-128 for symmetric encryption to lower the processing overhead and a partial challenge solving chain as well as a TAS to provide strong authentication. Several hash functions have been analysed as well as several random number generating approaches. At the same time, in order to fit the key generation and distribution algorithms together with the regular sensor operation, code optimizations were carried out on the cryptographic library Relic-Toolkit, reducing the memory footprint in 4KB; code reductions on Contiki OS allowed it to run using only 18KB of flash; and the peripheral drivers developed for the CC430 reduced as well the computation time. The solution allows to generate and distribute the keys in situ and is proved to be resilient to most adversaries while taking into account scalability, portability, energy consumption and making it suitable for consumer applications.Wireless Sensor Networks have become popular during the last years. The introduction of IPv6 which broadened the address space available, IEEE802.15.4 and adaption layers such as 6loWPAN have allowed the intercommunication of small devices. These networks are useful in many scenarios such as civil monitoring, mining, battlefield operations, as well as consumer products. Hence, practical security solutions for the intercommunication must be provided, ensuring privacy, authenticity, integrity and data freshness. In most cases, WSN nodes are not tamper-proof and have very limited available resources and capabilities which makes PKI currently not attractive for this environment. At the same time, key pre-distribution provide too low security for most applications. Therefore, the communication bootstrapping or the key generation and distribution problem is an important concern to be addressed with the additional difficulty of the constrained capabilities of WSN nodes. In this thesis, a solution to this problem is described. It makes use of ECDH and the curve K-163 for key exchange, AES- CCM-128 for symmetric encryption to lower the processing overhead and a partial challenge solving chain as well as a TAS to provide strong authentication. Several hash functions have been analysed as well as several random number generating approaches. At the same time, in order to fit the key generation and distribution algorithms together with the regular sensor operation, code optimizations were carried out on the cryptographic library Relic-Toolkit, reducing the memory footprint in 4KB; code reductions on Contiki OS allowed it to run using only 18KB of flash; and the peripheral drivers developed for the CC430 reduced as well the computation time. The solution allows to generate and distribute the keys in situ and is proved to be resilient to most adversaries while taking into account scalability, portability, energy consumption and making it suitable for consumer applications.