[Last Call] Learn how to a build a cloud-first strategyRegister Now


How to create a "registration key" for my application

Posted on 2006-05-05
Medium Priority
Last Modified: 2008-01-16

I am trying to create simple a registration key (CD KEY) system for my applications,
I want a the ability to create a private key and lots and lots of public keys from the private key

For example
I would have a dialog box where my users could enter the public key I have generated for them that would get compared to the private key that is embedded in side of my application, if the public key is valid then the program will unlock its self.

I am looking for a tutorial in C/C++ or MFC on creating private/public keys and validating them.
A link will do,

I know close to nothing about encryption
I’m experienced in C\C++\MFC

Thank you for your time and effort
Question by:funvill
  • 2
  • 2
LVL 25

Expert Comment

ID: 16644033
Well, the RSA algorithm is not highly difficult to implement yourself...

Once you have implemented such an algorithm though, when the user provides the public key, to ensure that it is suited to the embedded private key, you simply encrypt something with the public key, decrypt the ciphertext with the private key, and then return the decrypted result to the original data... if they match, then it's a valid pair.

Wikipedia has info regarding the RSA algorithm (how it works exactly), check it out !

Author Comment

ID: 16644338
Thanks for your replay

Will I be able to generate lots of different public keys with a signle private key?
Do you have a C/C++/MFC tutorial online about RSA that I could look over?

Is there a public/free for commercial use class or library I could use to create and validate RSA keys?
LVL 25

Accepted Solution

InteractiveMind earned 1600 total points
ID: 16648210
> Will I be able to generate lots of different public keys with a signle private key?

No; there is a single mapping from public to private — not several.

But, if you're just thinking of a way to create registration keys for some software of yours, then a better technique would probably be to use AES ("Rijndael"). This is a symmetric cipher algorithm - meaning that there's just a single key.

The key will be embedded into the software (hard-coded). When the user provides his or her name and password (for example), your systems will use the same key embedded into the software, to encrypt their name and password - the resulting ciphertext will then be used to produce a registration key.

Then, to register the software, the user types his/her name, password, and registration key into the software. The software performs the encryption etc on the name and password, and compares the result to the registration key.

If they match, then it's valid - and the software is now registered...

Here's a C++ implementation of the AES algorithm:

Author Comment

ID: 16653744
Workes great

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question