Cryptographic Hash Algorithms - securing Registry entry

I have a routine which encrypts any given string so that anyone browsing the registry is unable to read it.  What I need is a way of preventing my application from being copied to another machine.  To do this I wanted the app, on startup, to look for this certain encrypted registry value, and if it's not there - to close the app.

However, what is to stop a person from copying and pasting that registry value to another machine - and thereby allowing the application to run on another machine?  Whether or not they are able to read and understand the registry value, if they can copy and paste it anyway (regardless of the fact that they cannot understand it) then the value might as well not be encrypted.

I want to give my app to someone to use for a couple of weeks for testing and I want to prevent their copying the Debug folder contents to other machines.  Is it possible to completely 'hide' a registry value?

Please help.
TIA.
LVL 1
Sigh_ManAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Zamba1Commented:
You could create a code that contains data of the machine so that anyone copying the key would still not get your app running. This sounds like activation I know, but this way you would secure your program, not the registry. You could use the windows serial number or anything else that identifies the machine more or less.
Sigh_ManAuthor Commented:
How do I access the machine's CPU serial number (say)?
Could I get this from Environment....... in the same way I would get Environment.UserName (or something similar - I'm away from my development machines at the moment and don't have VStudio handy!).

Thanks.
Zamba1Commented:
Please see the following link for a long (but very interesting) discussion thread about that kind of protection:

http://www.dotnet247.com/247reference/msgs/57/288174.aspx
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

Bob LearnedCommented:
(1) Add a reference to System.Management.dll

(2) Imports System.Management

(3) Add this function:

  Public Function GetMotherboardSerial() As String

    Dim query As String = "Select * From Win32_BaseBoard"

    Dim searchSerial As New ManagementObjectSearcher(query)

    For Each boardCurrent As ManagementObject In searchSerial.Get

      Return boardCurrent.Properties("SerialNumber").Value.ToString

      Exit For

    Next

  End Function 'GetMotherBoardSerial'

Bob

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sigh_ManAuthor Commented:
Bob,

Using your function, how would I get the name of the machine without having to specify the computer, user name and password?
I want to slip this routine into my app with the intention of getting the serial number for the computer it is installed on -- the name of which, of course, I won't know.

Cheers.
Sigh_ManAuthor Commented:
I solved the first bit.....

MsgBox(GetMotherboardSerial(Environment.MachineName, Environment.UserName, "<mypassword>"))

......but what if I don't know the user password?  Surely I can still obtain m'board details??
Sigh_ManAuthor Commented:
Ah,........it doesn't appear to need a password.  The following works:
MsgBox(GetMotherboardSerial(Environment.MachineName, Environment.UserName, ""))

Er......in fact, so does:
MsgBox(GetMotherboardSerial("", "", ""))

So I guess the following will do the job:

Public Function GetMotherboardSerial(ByVal computer As String, _
    ByVal user As String, ByVal password As String) As String
    Dim query As String = "Select * From Win32_BaseBoard"
    Dim searchSerial As New ManagementObjectSearcher(query)
    For Each boardCurrent As ManagementObject In searchSerial.Get
      Return boardCurrent.Properties("SerialNumber").Value.ToString
      Exit For
    Next
End Function 'GetMotherBoardSerial'


Thanks again.
Sigh_ManAuthor Commented:
I meant to say...

I guess the following will do the job...

Public Function GetMotherboardSerial() As String
    Dim query As String = "Select * From Win32_BaseBoard"
    Dim searchSerial As New ManagementObjectSearcher(query)
    For Each boardCurrent As ManagementObject In searchSerial.Get
      Return boardCurrent.Properties("SerialNumber").Value.ToString
      Exit For
    Next
End Function 'GetMotherBoardSerial'
Sigh_ManAuthor Commented:
Does anyone know how to get the motherboard serial number from the OS?  Is there a command in cmd shell that would locate this?  Or does it show somewhere when the system is booted up?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.