Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 85329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:04:20+00:00 2026-05-10T22:04:20+00:00

For a web application, I would like to create a simple but effective licensing

  • 0

For a web application, I would like to create a simple but effective licensing system. In C#, this is a little difficult, since my decryption method could be viewed by anyone with Reflector installed.

What are some methods for encrypting files in C# that are fairly tamper-proof?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T22:04:21+00:00Added an answer on May 10, 2026 at 10:04 pm

    It sounds like you want to be using Public/Private cryptography to sign a license token (an XML Fragment or file for example) so you can detect tampering. The simplest way to handle it is to do the following steps:

    1) Generate a keypair for your company. You can do this in the Visual Studio command line using the SN tool. Syntax is:

    sn -k c:\keypair.snk 

    2) Use the keypair to strongly name (i.e. sign) your client application. You can set this using the signing tab in the properties page on your application

    3) Create a license for your client, this should be an XML document and sign it using your Private key. This involves simply computing a digital signature and steps to accomplish it can be found at:

    http://msdn.microsoft.com/en-us/library/ms229745.aspx

    4) On the client, when checking the license you load the XmlDocument and use your Public key to verify the signature to prove the license has not been tampered with. Details on how to do this can be found at:

    http://msdn.microsoft.com/en-us/library/ms229950.aspx

    To get around key distribution (i.e. ensuring your client is using the correct public key) you can actually pull the public key from the signed assembly itself. Thus ensuring you dont have another key to distribute and even if someone tampers with the assembly the .net framework will die with a security exception because the strong name will no longer match the assembly itself.

    To pull the public key from the client assembly you want to use code similar to:

        /// <summary>     /// Retrieves an RSA public key from a signed assembly     /// </summary>     /// <param name='assembly'>Signed assembly to retrieve the key from</param>     /// <returns>RSA Crypto Service Provider initialised with the key from the assembly</returns>     public static RSACryptoServiceProvider GetPublicKeyFromAssembly(Assembly assembly)     {         if (assembly == null)             throw new ArgumentNullException('assembly', 'Assembly may not be null');          byte[] pubkey = assembly.GetName().GetPublicKey();         if (pubkey.Length == 0)             throw new ArgumentException('No public key in assembly.');          RSAParameters rsaParams = EncryptionUtils.GetRSAParameters(pubkey);         RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();         rsa.ImportParameters(rsaParams);          return rsa;     } 

    I’ve uploaded a sample class with a lot of helpful Encryption Utilities on Snipt at: http://snipt.net/Wolfwyrd/encryption-utilities/ to help get you on your way.

    I have also included a sample program at: https://snipt.net/Wolfwyrd/sign-and-verify-example/. The sample requires that you add it to a solution with the encryption utils library and provide a test XML file and a SNK file for signing. The project should be set to be signed with the SNK you generate. It demonstrates how to sign the test XML file using a private key from the SNK and then verify from the public key on the assembly.

    Update

    Added an up to date blog post with a nice detailed run through on license files

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 118k
  • Answers 118k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The two concepts are pretty orthogonal, neither complementing nor contradicting… May 11, 2026 at 11:30 pm
  • Editorial Team
    Editorial Team added an answer No, it won't start 1000 threads - yes, it will… May 11, 2026 at 11:30 pm
  • Editorial Team
    Editorial Team added an answer i don't see why you should have to convert to… May 11, 2026 at 11:30 pm

Related Questions

I am creating a web application using EJBs and servlets. I have a page
I'm about to create a web application that requires a lot of different web
I am working on a .NET 3.5 project which consists of a web application
I'm creating the server side implementation of an AJAX based web application, where the

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.