Improved validation of user's public key.