Re: Encryption keys

From: William Stacey [MVP] (staceywREMOVE_at_mvps.org)
Date: 02/03/05


Date: Thu, 3 Feb 2005 18:22:34 -0500

Thanks Nick. Just thinking... If the key is hashed by the server using a
simple hash like SHA1(key) or something, then it is pretty easy to brute
force the same key by hashing all keys and hashing them. Naturally,
starting from 0 may take some time, but a 16 byte key in a simple hash with
no other encryption could be found pretty easy - no? I might rather hash
the key along with the other data elements and sign it with the private key.
Thoughts?

BTW - any relation to Eddy Malik of MS?

-- 
William Stacey, MVP
http://mvp.support.microsoft.com
"Nick Malik [Microsoft]" <nickmalik@hotmail.nospam.com> wrote in message
news:ZtadnRSDv6Sh5p3fRVn-pA@comcast.com...
> SSL uses asymmetric encryption, but only for the handshake. It's a good
> pattern to follow.
>
> Embed the public key of your server in your code.  Make it available all
you
> want.
>
> When a client wants to contact you, he asks first for the cert.  give it
to
> him.  Validate the cert.  It should be signed by a trusted authority.
>
> Next, the client creates a random number.  This is the symmetrical key.
The
> client encrypts the random number using the public key of the server, and
> passes it upstream to the server.  It also hashes the UNENCRYPTED form of
> the key and keeps it around in memory.  The server gets the cyphertext,
> unencrypts it, and passes back an acknowledgement, in cleartext,
containing
> the Hash of the unencrypted key.  The client receives the hash and
compares
> it to the hash that he is holding.   If it matches, both sides now have a
> symmetrical key that they can use.
>
> Now, encrypt using the symmetrical key.  It is much faster and easier to
> use.
>
> -- 
> --- Nick Malik [Microsoft]
>     MCSD, CFPS, Certified Scrummaster
>     http://blogs.msdn.com/nickmalik
>
> Disclaimer: Opinions expressed in this forum are my own, and not
> representative of my employer.
>    I do not answer questions on behalf of my employer.  I'm just a
> programmer helping programmers.
> --
> "Ray Cassick (Home)" <rcassickNOSPAM@enterprocity.com> wrote in message
> news:%23%2349grOCFHA.3416@TK2MSFTNGP09.phx.gbl...
> > Ok, time to ask the question here.. I have been battling over this one
for
> > sometime now and just have to ask it.
> >
> > I have created a few classes that I use to act a security keys. These
> > classes get serialized using a binary formatter and then symmetrically
> > encrypted. The app will deserialize them and use the contents to judge
> > licensing capabilities, etc.
> >
> > Currently the license key and vectors are stored in the code. I don't
like
> > the idea simply because it allows someone with a decompile to get at
them.
> > Yes, I can obfuscate the code but being paranoid like I am I have a
> feeling
> > that is just not enough.
> >
> > My real biggest fear besides the fact that someone can use the key to
> > decrypt the data is that someone can also use the same key to create a
> > program that will generate fake license keys for my app.
> >
> > In another case I have to send a class across a wire on a remoting
channel
> > and the class is going to have a users name and password in it. Again,
> being
> > the paranoid programmer that I am I am really afraid of someone with a
> > sniffer out there looking at the raw bits. I would like to encrypt the
> > password before I send the class across the wire. Again, I know that I
can
> > just hard code the keys into the app but we all know what I feel about
> that.
> >
> > I know that I could use asymmetrical encryption and that gives me the
> > ability to release a public key that can only be used to decrypt and
that
> > takes care of part of it but from what I have seen asymmetrical
encryption
> > is a royal pain in the *** because it only encrypts data of a maximum
> size
> > so I would have to take that into account when I am serializing data and
> > possibly split the data up into checks, each one encrypted.. Not a clean
> > option really.
> >
> > I know already, I have read tones of thing on remoting and how to build
> > encryption sinks to be used for cases like this, but I really don't need
> to
> > encrypt the entire message, just one part of it.
> >
> > There HAS to be a way to reliably use symmetrical encryption without
hard
> > coding the keys into the code but also protecting them from being used
by
> > other people.
> >
> > Any simple ideas to this tough question?
> >
> >
>
>