Local key management in opportunistic networks