How to add registry key verification step with the key being stored in another database I am currently learning how to use Drupal through Udemy classes; I am a complete newbie. 

I am building a Drupal Website, for my personal development, and when someone wants to register to the website I want the to fill in the typical form: full name, organization, etc (stuff like what Facebook for example asks). However, I want to add one extra identifier: registry number. What I really need to know is how to make this secure; so that when you type in a number; if it is not correct or it is random, then it would not allow you to register (sounds like the CD keys old PC games had).

Typically, those registry numbers are within the government ministries (say for businesses registries). For example to make taxes you have a registry key, i think that is how it is called; then when you do your taxes online you add that key to verify it is you. But how does the system know that key you entered is correct? It must be connected to a database that has all this information stored. 

How do can I make this happen for my drupal website? But is it also feasible? (it must be right?)
What you want is quite doable on Drupal, however if you just started learning Drupal then I am afraid you need to find an experienced developer, who could write up a custom module using the hook_field_validate().