RE: Where to store application expiration date in a trial app

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



You say "Such as the Registry" making the assumption that it is a "secure
place". It is not. Anybody can use Regedit to search and modify the registry
on their own machine. Isolated storage would probably be a potential choice.
You have methods in .NET framework to access this. DPAPI is another choice,
including encryption.

If you are looking for a commercial solution, there are a number of them
available. I'd start my search at some place like ComponentSource.com.

Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




"Mike9900" wrote:

I wanted a secure place such as registry to store the date/time expiration of
the software. For example, if the software expires in 30 days, each day the
user starts the program it increments the date and stores that date in a
file, it may encrypt it as well. So where is the most secure place to store
that file, also the user must have access right to that place.

Is there a better way for licensing software, or is there a good component I
can buy?
--
Mike


"Peter Bromberg [C# MVP]" wrote:

Mike,
here is a "greatly simplified" example of how you could do this. Be aware,
this is NOT SECURE from decompilation!:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Reflection ;

[assembly: AssemblyConfiguration("06/10/2006")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AssemblyConfigurationTest
{
public class WebForm1 : System.Web.UI.Page
{
DateTime ExpirationDate;

private void Page_Load(object sender, System.EventArgs e)
{
Assembly asm = Assembly.GetExecutingAssembly();
int asmHash = asm.FullName.GetHashCode();
object[] objArray=asm.GetCustomAttributes(false) ;
int hash ;
foreach (object obj in objArray)
{
AssemblyConfigurationAttribute conf =
obj as AssemblyConfigurationAttribute;
if (conf != null)
{
hash = conf.Configuration.GetHashCode();
if(hash !=-579392602 || asmHash!=-258347722)
throw new InvalidOperationException("Assembly Has been Altered! Bad,
Bad!");
this.ExpirationDate=Convert.ToDateTime(conf.Configuration) ;
}
}
Response.Write("This Trial Version Expires: "
+this.ExpirationDate.ToString());
}



--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




"Mike9900" wrote:

Hello,

I would like to store application expiration date in a file and store that
file in a secure place, so the application can access the file for all the
users on that computer.

IsolatedStorage is a good technique but it is for the each user only and is
not machine level. Registry is not good because the user may not have access
permission. Application directory is not good because the file could be
deleted and so the application trial mode does not work. So what directory
is good or does windows has an API to store a file or data?

--
Mike
.



Relevant Pages

  • RE: "What is better" question ...
    ... As for the where to store those privacy datas in our published programs ... there used to be many softwares which use the registry ... application's binary executable file itself. ... Get Secure! ...
    (microsoft.public.dotnet.general)
  • RE: Where to store application expiration date in a trial app
    ... obj as AssemblyConfigurationAttribute; ... I would like to store application expiration date in a file and store that ... file in a secure place, so the application can access the file for all the ... deleted and so the application trial mode does not work. ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Where to store application expiration date in a trial app
    ... For example, if the software expires in 30 days, each day the ... So where is the most secure place to store ... obj as AssemblyConfigurationAttribute; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Where to store DB Name and Password
    ... If you don't feel that's secure enough, you can store your password ... encrypted in the registry. ... > currently storing the DB name and password in a table. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: "What is better" question ...
    ... binary file, require re-compilation for each change in these variables. ... > As for the where to store those privacy datas in our published programs ... > secure means. ... there used to be many softwares which use the registry ...
    (microsoft.public.dotnet.general)