For banned keys, send a query with the cd key (MD5) and a udp packet to the master BE server. Parse the response as ASCII and if you get #asdf, it means the key is banned. If you get nothing, it means the key isn't banned. But just because the key isn't banned, doesn't mean it's valid either. As far as key validity goes, that involves the Master Gamespy Server...Pretty sure all of this has been posted already.
BE Server IP Address: BattleEye Server IP: 81.0.236.117: 2324