Do you create the key generator yourself or use ready-made libraries?
I read a great topic on stackoverflow.com. Here is a detailed description how to validate keys. But it looks laborious, if I understood correctly.

I would be grateful for advice, articles, any help.