473,382 Members | 1,526 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Generating licence key & expiry date from C/C++

Hi,

Can anyone suggest a way to generate a licence key from C/C++ program?
I want to create a licence file include an encrypted text and an expiry
date. The private key is hard coded in the program which will be used to
encrypt and decrypt the licence key from the licence text file.
With RSA, I want to hardcode a plain text as a private key in the C/C++
program, and store a signed public-key (the licence key - also include
an expiry date) in the licence file.
Can I use RSA private-public key pair to handle this task?

Thanks
D
Jul 23 '05 #1
2 8260
Dave wrote:
Hi,

Can anyone suggest a way to generate a licence key from C/C++ program?
I want to create a licence file include an encrypted text and an expiry
date. The private key is hard coded in the program which will be used to
encrypt and decrypt the licence key from the licence text file.
With RSA, I want to hardcode a plain text as a private key in the C/C++
program, and store a signed public-key (the licence key - also include
an expiry date) in the licence file.
Can I use RSA private-public key pair to handle this task?
It seems that this similar to store MD5 encrypted password in a text
file, the user need to enter a plain-text passowrd to authenticate with
the decrypted password from the file. In this sense, the password is
similar to the private key as hardcoded in the C/C++ program.

Thanks
D

Jul 23 '05 #2
Dave wrote:
Hi,

Can anyone suggest a way to generate a licence key from C/C++ program?
I want to create a licence file include an encrypted text and an expiry
date. The private key is hard coded in the program which will be used to
encrypt and decrypt the licence key from the licence text file.
With RSA, I want to hardcode a plain text as a private key in the C/C++
program, and store a signed public-key (the licence key - also include
an expiry date) in the licence file.
Can I use RSA private-public key pair to handle this task?

Thanks
D


This is not really C++ specific and therefore off topic here. However, here
are my two cents:

Yes, RSA seems appropriate: You could generate *two* RSA public/private key
pairs, one for you and one for the program. Your public key and the private
key of the program go hardcoded into the program. Keep your private key and
the public key of the program to yourself. You will use them to create
license files. Now, the program and you are Alice and Bob in a signed
message echance scheme where the license file is the signed message.

The program will use its private key to decrypt the license file and it
will use your public key to verify the signature.

Note that since you hardcode the keys into your program, they are known to
any attacker. However, an attacker who wants to forge a license file will
need your private key.

There is however a cracking attack: An attacker can replace the hardcoded
keys within the binary by keys of his own and use the corresponding keys to
fake license files. I think this kind of attack can in principle always be
mounted: even if you include some safeguard like checking a hashcode of the
public key before using it, those hashcodes can also be replaced. All you
can do, as far as I can see, is to drive up the costs of an attack.
Best

Kai-Uwe Bux
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Vince C. | last post by:
Hi all. I'm trying to set a cookie expiry date but my script is JS (JavaScript). I've tried Response.Cookies("Test").Expires = Date(); Response.Cookies("Test").Expires =...
4
by: The Blob | last post by:
Hi all, I need sone help on generating a SQL statement i had 3 tables now Customer >> Name >> Acct No >> Address
4
by: ianv2 | last post by:
Hi Is the following possible using Javascript ? I would like a page to redirect to another page if the page expiry has passed. E.G. If my questionnaireform.html page had an expiry date...
4
by: Raquel | last post by:
I have downloaded UDB PE 8.1 on Win XP. Issuing the command "db2licm -l" gives the following output: Product Name = "DB2 Personal Edition" Product Password =...
4
by: William Bradley | last post by:
I have two cells on a form. One of them is the "Production Date" and the other is the "Expiry Date". The "Expiry Date" is 183 days after the "Production Date." On an Excel spreadsheet, the...
2
by: William Bradley | last post by:
"Marshall Barton" <marshbarton@wowway.com> wrote in message news:9as9lvgpnp783kogctb88c8giaepb5uf6g@4ax.com... > William Bradley wrote: > >I have two cells on a form. One of them is the...
3
by: hasanainf | last post by:
Hi all, What will be the best database design for an inventory control that uses expiry date for its products. Over a period of time, a particular product will have many expiry date and that...
2
by: JezB | last post by:
I have a windows application that I'd like to sell eventually. What's the simplest way to provide a secure licensing mechanism ? I'd prefer to have a licence key that can't simply be distributed...
1
by: IanWright | last post by:
I'm trying to think of a suitable licence model for a toolkit that I'm designing, and have come up with the following, and would like thoughts / opinions or suggestions that people can offer. The...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.