Scheme for authentication and dynamic key exchange