I suppose the fist step towards any implemention in TinyOS (other similar OSs) is to get familiar with it by running through the tutorial. Then you may choose one sample app that goes close to what you need as a starting point. Btw, there have been quite some security related implementation, so you may want to see if you can use them as the basis.