473,216 Members | 1,296 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,216 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 8238
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...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

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.