Hello everyone,

With the help of some of you guys, i managed to make my first program!
To share it with some people, but to prevent that everybody can use it, i would like to build a licence in it.
Therefore I want to make a program, so I can make my own serialkeys to implement it in the program.
I've been surfing on the internet and found some examples about Cryptography.
In the examples they give little pieces of code, but it won't work.

Now my question is: Does someone have a program, or the complete code for a program that can encrypt and decrypt data and wants to share it with me?
That would really help me a lot!

Thanks in advance!!

Sneaky Pete

Here is an article on CodeProject that contains all the source code to do exactly what you are wanting.

Thanx, I will give it a try!

Ok,

I've read the article, but it's not what I'm looking for.
I'm looking for a good tutorial where the code is explained step by step to make a program to encrypt and decrypt a string with a secret key. If someone have a link or a good code it will help me a lot!

Thanx

Ok, let me be more specific.

I've made a program that can be used by some of my colleagues.
The program needs a licence which is valid for x (30 or 60) days so the program must count down the time. This can be done by i timer I think.

Now I need a program that can generate random serialnumbers which is input for the other program and the licenceperiode will be extended by x days. Therfore you'll need a symmetric cryptography so there is a secret key in it. The other program must have this key and by generating a new serial the program has to verify it and extend the licenceperiod.

Now my question is:
- How can I make my own keygenerator based on symmetric cryptography?
- Is there a tutorial to make a program like this? I would like to have a step by step walk through so I can make the program by myself and can learn something.
- Can some of you can help me with this by giving me a link to a turorial or by giving me a example of a similar program?

Thanx in advance!

Sneaky Pete

There are several examples of encryption/decryption in the VB.Net forum. Just click on Code Snippets and scroll through the list. As for the timer thing, based on what you have said, it would only work if the user left the program running all the time. A timer won't function when the program is not running and when the program restarts the timer will be reset (unless you save the current value on exit). What you can do is create an Application level Settings variable and encrypt and save the expiration date when the program is first run. The program can decrypt and compare against the system date/time on startup. If the user applies an extension then the program can rewrite the expiration date. Keep in mind that with a program like TimeStopper, the user can effectively freeze the system date for that program.

I totally agree with Reverend, that timer won't work, but I also want to point out a couple of things:
a) If you design a solution that would extend the "license" x days then you need to make sure that your key expires or just go with the much simpler way of extending the license until a specific date that is hidden inside your key. This way its not that easy to fool the system by using the same key over and over again and you can't change system date to one after 6 months and then use the key - thus extending the use of the program for 6+ months.
b) Keys that don't require a key to be passed from the computer can be used in any computer. This means that if a colleague of yours wants to "smuggle" keys to somebody else, they are free to do so. Build into your license logic an encoded string that will carry something unique about that computer (could be as easy as computername) and that will be part of the key you return - and of course get's validated with the key.
c) Anything you build can be very easily reverse engineered. When coding in .Net always have in mind that a decompiler can reveal your code. It might be as easy as stealing the logic of your key and then create their own or steal the actual code for your program and copy/paste into a new project. I know that you are planning to give this to your colleagues, but have it in mind. You are just keeping it safe until somebody that knows how to do it comes along - or get's a copy of your program.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.