473,769 Members | 2,515 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8328
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
19895
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 = Date().toLocaleString(); Response.Cookies("Test").Expires = Date().toString(); Response.Cookies("Test").Expires = Date().toUTCString();
4
2445
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
2857
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 of July 31, if I
4
1886
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 = "DB2PE" Version Information = "8.1" Expiry Date = "Permanent" Annotation = "" Other information = ""
4
10063
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 "Expiry Date" is automatically entered, when the "Production Date" is entered. To do this the "Expiry Date" cell carries the following formula: "=A15+183". I would like to be able to do the same on an Access Form, with the results written to the...
2
3523
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 "Production Date" and the >other is the "Expiry Date". The "Expiry Date" is 183 days after the >"Production Date." > >On an Excel spreadsheet, the "Expiry Date" is automatically entered, when >the "Production Date" is entered. To do this the "Expiry...
3
9260
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 one particular expiry date could have multiple products I am thinking of two approaches not knowing which one to go for. First design is of one product having many expiry dates (a one to many
2
2579
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 across the pirate community (eg. astalavista) that will then work on any pc, so I was thinking of somehow tying it to the machine (some unique ID like the NIC number, but I realise some computers without a network card don't have one!). I'd need to...
1
2014
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 toolkit is going to allow setup + solving of specific non linear problems. The ideas I had were: 2 different licences. 1 Developer, 1 Runtime, which I want to strictly be used appropriately. Developer licence: Allow many instances of the toolkit...
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9422
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10208
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10036
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9987
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9855
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8863
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5294
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3558
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.