Text this: Key infection and its applications in sensor networks