Added random key generation and verification at client.