Home All Groups Group Topic Archive Search About

Encrypt a date to use in demo version

Author
26 Sep 2006 2:26 PM
Christie
My app creates a rigistry entry of the date when it is installed, which
is then used to determine when the demo expires...It is working fine
but I would like to encrypt the date somehow...is there a relative easy
way to do this, as different machines will have different date
formats??

I am using Visual Studio 2005(VB.Net)

Author
26 Sep 2006 3:35 PM
Mike Lowery
"Christie" <c.mybu***@yahoo.com> wrote in message
news:1159280772.462056.294700@m73g2000cwd.googlegroups.com...
> My app creates a rigistry entry of the date when it is installed, which
> is then used to determine when the demo expires...It is working fine
> but I would like to encrypt the date somehow...is there a relative easy
> way to do this, as different machines will have different date
> formats??
>
> I am using Visual Studio 2005(VB.Net)

Check out the System.Security.Cryptography namespace.
Author
26 Sep 2006 7:47 PM
teslar91
Christie wrote:
> My app creates a rigistry entry of the date when it is installed, which
> is then used to determine when the demo expires...It is working fine
> but I would like to encrypt the date somehow...is there a relative easy
> way to do this, as different machines will have different date
> formats??
>
> I am using Visual Studio 2005(VB.Net)

Hi Christie,

    Dim s1 As String = Now().ToBinary.ToString ' convert date to string
    Dim d1 As Date = Date.FromBinary(Val(s1)) ' convert string back to
date

The string contains a Long numeric representation of the date/time,
which always works regardless of your regional settings.

Then it's just a matter of encrypting/decrypting the string.  You could
use the Cryptography namespace as suggested; it's a bit daunting to
learn, but worth it.  There's also any number of all-VB encryption
techniques you could Google up, or you could even whip up your own.
Just depends on how strong you prefer your encryption.
Author
26 Sep 2006 7:50 PM
teslar91
Christie wrote:
> My app creates a rigistry entry of the date when it is installed, which
> is then used to determine when the demo expires...It is working fine
> but I would like to encrypt the date somehow...is there a relative easy
> way to do this, as different machines will have different date
> formats??
>
> I am using Visual Studio 2005(VB.Net)

Hi Christie,

    Dim s1 As String = Now().ToBinary.ToString ' convert current date
to string
    Dim d1 As Date = Date.FromBinary(Val(s1)) ' convert string back to
date

The string contains a numeric Long representation of the date/time,
which works regardless of the regional settings.

Then it's just a matter of encrypting/decrypting the string.  You could
use the Cryptography namespace as suggested; it's a bit daunting to
learn but worth it.  Or, you could Google up source code for any number
of all-VB encryption functions.  Or, whip up your own.  Just depends on
how strong you want your encryption.
Author
26 Sep 2006 8:14 PM
rowe_newsgroups
Do a quick search in this news group for "Database Connectivity"
Towards the end "Izzy" posts the source code for a 128 bit encryption
scheme. I haven't tried it but you should definately check it out.

Thanks,

Seth Rowe

tesla***@hotmail.com wrote:
Show quoteHide quote
> Christie wrote:
> > My app creates a rigistry entry of the date when it is installed, which
> > is then used to determine when the demo expires...It is working fine
> > but I would like to encrypt the date somehow...is there a relative easy
> > way to do this, as different machines will have different date
> > formats??
> >
> > I am using Visual Studio 2005(VB.Net)
>
> Hi Christie,
>
>     Dim s1 As String = Now().ToBinary.ToString ' convert current date
> to string
>     Dim d1 As Date = Date.FromBinary(Val(s1)) ' convert string back to
> date
>
> The string contains a numeric Long representation of the date/time,
> which works regardless of the regional settings.
>
> Then it's just a matter of encrypting/decrypting the string.  You could
> use the Cryptography namespace as suggested; it's a bit daunting to
> learn but worth it.  Or, you could Google up source code for any number
> of all-VB encryption functions.  Or, whip up your own.  Just depends on
> how strong you want your encryption.