key validation and expiration