TinyOS layer for configurable protection of message privacy, intrusion detection and key distribution