Click here to Skip to main content
15,879,239 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

I am working on Windows application.
I am planing to make application secure, so I need to implement one activation process for the same.

I want to develop an encryption & decryption algorithm so I can possibly read client side parameters & can create a secure activation key for the same.

I am planing to use Blow fish algorithm which is very secure & easy to implement.

Is there any alternative way of doing it?

Any kind of link, suggestion and specially expert advice would be highly appreciated.


Regards,
Balkrishna Raut
Posted
Updated 16-May-16 20:45pm
v2
Comments
Dalek Dave 11-Jan-11 6:08am    
Edited for Grammar and Readability.

The other solution is to use the .NET built in encryption. (See the System.Security.Cryptography namespace)
This has teh advantage that the algorithms are already implemented, tested, and proven: If your software disappears due to a disk crash (say) it is possible to restore your data if you still know the passswords...

I would not implement an encryption algorithm if there is a known good implementation available: it is a waste of work, and a potential security risk.
 
Share this answer
 
Comments
Dalek Dave 11-Jan-11 6:09am    
Good Advice
Hope Microsoft[^] and Sharp tutorial[^] will give you an idea.
 
Share this answer
 
Comments
Dalek Dave 11-Jan-11 6:09am    
Good Link.
Kasson 11-Jan-11 6:10am    
Thanks Dalek.
.NET provide inbuilt encryption technique using 'System.Cryptography' namespace and various in-built encryption algorithms like,
1. AES
2. Blowfish
3. DES
4. Triple DES
5. Serpent
6. Twofish
7. Camellia
8. CAST-128
9. IDEA,RC2,RC5,SEED,Skipjack,TEA,XTEA, XOR etc

Here is the code to encrypt your string with the help of XOR you need to use 'System.Cryptography'
C#
public string EncryptDecrypt(string szPlainText, int szEncryptionKey)  
     {  
       StringBuilder szInputStringBuild = new StringBuilder(szPlainText);  
       StringBuilder szOutStringBuild = new StringBuilder(szPlainText.Length);  
       char Textch;  
       for (int iCount = 0; iCount < szPlainText.Length; iCount++)  
       {  
         Textch = szInputStringBuild[iCount];  
         Textch = (char)(Textch ^ szEncryptionKey);  
         szOutStringBuild.Append(Textch);  
       }  
       return szOutStringBuild.ToString();  
     }  

see link below for more details
PrasadDotNetTricks: Simple encryption in .NET using XOR technique[^]
 
Share this answer
 
Comments
Richard MacCutchan 17-May-16 2:55am    
Look at the date of this question!
koolprasad2003 17-May-16 3:05am    
Ooops..too old.
I haven't notice. Just reply it as it seen in active threads.
How make it ACTIVE ??
Richard MacCutchan 17-May-16 3:24am    
People such as the one below.
You should read up on Asymmetrical Encryption, and Digital Signature Algorithms.

You don't need an encryption & decryption (I assume you mean symmetrical) algorithm for an activation code. If you think about it, the same key is used to encrypt as to decrypt, meaning that the key itself needs to be provided to the application in order for it to work, which is an automatic fail on the security front.

You can secure an activation key by using the RSA or DSA algorithms. These are asymmetric encryptions, meaning you have a private key that can decrypt, and a public key that can only encrypt. They both have signature functions that generate a hash from your "activation code" then encrypt that hash to produce a signature. The message and the signature only match if they are unchanged - if you only have the public key, you can verify that the message (in your case the activation code) and the signature match, but you need the private (secret) key to generate the signature.

I wrote an article on this a long time ago - the code is clunky and has some bugs, but the article is well written and explains these concepts fairly well:

RSA License Protection[^]
 
Share this answer
 
Comments
Richard MacCutchan 17-May-16 2:56am    
Please do not post in old (and obviously dead) questions. This one is more than 5 years old.
Simon Bridge 19-May-16 23:15pm    
It was top of a list of questions without accepted answers, and I thought I could make a contribution .. easy mistake to make. You don't have to make a big deal out of it, and down-voting my answer was just petty .. was it actually wrong? obviously people are still reading this page and posting comments, so someone might have got something out of it. I still get and read comments posted against articles and questions I wrote years ago and they still provide useful information.
If you are so concerned about this and not just wandering the site looking for people to chastise, close the question out.
Simon Bridge 19-May-16 23:17pm    
The OP edited the question only a few days ago. Makes it current to my thinking.
Richard MacCutchan 20-May-16 3:11am    
No that was most likely a spammer.
Simon Bridge 22-May-16 21:26pm    
How can you tell?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900