Here's how to do it:
Launch a new Terminal window from Applications:Utilities.
Enter the following command into the Terminal window, where /Applications/ is the directory where Xcode is installed. You must be on a system with Gatekeeper enabled.
spctl --assess --verbose /Applications/Xcode.app
After several minutes, the result of the validation test will be presented. If your copy is valid you will see one of these three messages.
source=Mac App Store