473,748 Members | 9,416 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Encryption keys

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 butt 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?
Jul 21 '05 #1
14 1949
Protecting a shared session key is always a problem. If it was not for
this, things would be a lot easier and a lot less books would be written on
it. However, you may not need symmetric key depending on exactly what your
sending and what goes which way (i.e. what to server and what to client.)
If using asymmetric keys, you need at least the server's public key to get
started. This could also be the server cert, but not required. Your assem
can have the public key already in it if you sign the assembly. So the
server will know the private key and the client's will know the server's
public key. Now encrypt your fields with the servers public key. Only the
server (the owner of the private key) can decrypt the fields. Your server
gens a reply (say an xml document with fields.) The server will sign the
reply with private key. Your client can verify server msg is good as it can
validate the signature using the server's public key it has. Now you have a
valid license. However, unless you add more logic, it is valid for *any
machine. You then need to come up with some method to identify a user's
particular machine (i.e. machine hash including user name, mac, domain name,
etc) and the server's reply will include this hash as you also send it in
the request. So your client will verify lic and fail if signature does not
validate. It will then verify the machine hash matches what you dynamically
calculate and compare the two to proceed or fail. No shared secret using
this method - only the server's public key retrieved from the assembly. If
you need to encrypt stuff sent to the client, then more work is needed.
There are a few options, but the best is to not require anything in the
reply that requires encryption. You can verify the lic was produced by the
server via just the signature and the lic will not work for everyone because
of the machine hash. HTH.

--
William Stacey, MVP
http://mvp.support.microsoft.com

"Ray Cassick (Home)" <rc************ @enterprocity.c om> wrote in message
news:##******** ******@TK2MSFTN GP09.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 butt 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?


Jul 21 '05 #2
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)" <rc************ @enterprocity.c om> wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l...
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 butt 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?

Jul 21 '05 #3
Thanks... This defiantly sounds like something I can put into the system...

"Nick Malik [Microsoft]" <ni*******@hotm ail.nospam.com> wrote in message
news:Zt******** ************@co mcast.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)" <rc************ @enterprocity.c om> wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l...
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 butt 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?


Jul 21 '05 #4
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]" <ni*******@hotm ail.nospam.com> wrote in message
news:Zt******** ************@co mcast.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)" <rc************ @enterprocity.c om> wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l...
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 butt 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?



Jul 21 '05 #5
"Ray Cassick (Home)" <rc************ @enterprocity.c om> wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l...
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.
This should be more than enough for your average user. Admittedly it won't
stop anyone familiar with .NET, but in that case they just round-trip your
assemblies and remove all licensing code completely, no matter what system
you use.
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.
Hmm, I've been writing a simple licensing system:
http://home.imaginet.co.za/codingsanity/Licensing.htm, but I don't
particularly care if the users can read my license file. I use digitally
signed XML files (look at http://www.codeproject.com/dotnet/xmldsiglic.asp),
with the public key embedded in an assembly attribute. Since it's an
asymmetric key, all anyone can do with it it read the files (which they can
do anyway since the files are cleartext). They can't generate a valid new
license file from that information. Round-tripping could easily get around
this system, but frankly it can easily get around any system.

I think it was Jon Skeet who pointed out that if people like your
application enough to be cracking it, you're probably making a bit of cash
from it, so why are you worrying about a tiny percentage cheating?
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 butt 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?

Jul 21 '05 #6
Hey Sean. Just curious. How are you protecting the license so that it is
unique the user and can not be emailed to another user? Using a machine
hash or something and signing that with the rest of the license? What do
you include in your machine hash?
do anyway since the files are cleartext). They can't generate a valid new
license file from that information. Round-tripping could easily get around
this system, but frankly it can easily get around any system.


Currently, you can't round-trip a XenoCode'd assembly. This may change in
the future with a new version of ildasm, but can't today. TIA

--
William Stacey, MVP
http://mvp.support.microsoft.com
Jul 21 '05 #7
Hi William,

no relation to Eddie Malik.

True, salting the key on both ends will help, but the value that you salt it
with has to be easily calculated by both ends independently of one another.
This helps, but not a whole heckuva lot.

Signing with the private key doesn't provide security, it provides
non-repudiation. In other words, since the public key is public, anyone can
decrypt something encrypted with a public key. However, only the owner of
the private key could have signed it (hence the name).

The way that SSL does it is to add one more step: the private key is used to
encrypt a known phrase (I believe it is the server name from the public key
cert plus the time stamp on the server), signed. The client decrypts with
the private key and then verifies the signature. That way, the client knows
that the server knows the key and knows that only the server could have
signed the response.

--
--- 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.
--
"William Stacey [MVP]" <st***********@ mvps.org> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
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]" <ni*******@hotm ail.nospam.com> wrote in message
news:Zt******** ************@co mcast.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)" <rc************ @enterprocity.c om> wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l...
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 butt 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?


Jul 21 '05 #8
Correction: I meant to say that the symmetric key is used to encrypt the
known phrase, not the private key. My apologies.

--
--- 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.
--
"Nick Malik [Microsoft]" <ni*******@hotm ail.nospam.com> wrote in message
news:Lu******** ************@co mcast.com...
Hi William,

no relation to Eddie Malik.

True, salting the key on both ends will help, but the value that you salt it with has to be easily calculated by both ends independently of one another. This helps, but not a whole heckuva lot.

Signing with the private key doesn't provide security, it provides
non-repudiation. In other words, since the public key is public, anyone can decrypt something encrypted with a public key. However, only the owner of
the private key could have signed it (hence the name).

The way that SSL does it is to add one more step: the private key is used to encrypt a known phrase (I believe it is the server name from the public key cert plus the time stamp on the server), signed. The client decrypts with
the private key and then verifies the signature. That way, the client knows that the server knows the key and knows that only the server could have
signed the response.

--
--- 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.
--
"William Stacey [MVP]" <st***********@ mvps.org> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
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]" <ni*******@hotm ail.nospam.com> wrote in message
news:Zt******** ************@co mcast.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)" <rc************ @enterprocity.c om> wrote in message news:%2******** **********@TK2M SFTNGP09.phx.gb l...
> 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 butt 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?
>
>


Jul 21 '05 #9
William Stacey [MVP] wrote:
Hey Sean. Just curious. How are you protecting the license so that it is unique the user and can not be emailed to another user? Using a machine hash or something and signing that with the rest of the license? What do you include in your machine hash?
In my currently posted code, I've just used the machine name. The
release I'm working on also allows for domain name, user name, primary
Cpu ID, primary MAC address, and a whole bunch of other variables (both
manually entered and automatically generated). Which ones you want are
set by a policy. The license file contains these values in the clear
currently. Since the license file comes back signed with those values
in them, I don't feel that hashing is required, since any tampering
with the values will invalidate the license file.

I'm also trying to make the whole scheme extensible. The default Policy
works off a signed policy file, but you can implement your own Policy
classes if you want. Basically I'm aiming for a sort of Licensing
Application Block. Any ideas will be welcomed, you can view my email
address at http://home.imaginet.co.za/codingsan...ages/email.jpg.
Don't use this one I posted with, it's just spambait ;D.

I'd also like to implement a license server, license tracking system,
and various other goodies (but that might take a while). As usual, I
started working on this as just a simple licensing system for a little
commercial app I wrote for a friend and it just sort of ballooned out
of control ;D

I'll blog about improvements and releases as I make them.
Currently, you can't round-trip a XenoCode'd assembly. This may change in the future with a new version of ildasm, but can't today. TIA


Interesting about XenoCode, does anyone have any idea how they crash
ILDASM?

In any case my licensing system is not meant to be a replacement for
top-quality systems like that and XHEO, but rather a decent-quality
system with enough features to be useful, and extensible enough to be
flexible. Good enough to stop someone with a bit of knowledge with
registry and XML, but not enough to stop someone with the ability to
roundtrip. Of course, if someone can let me know how to crash ILDASM,
then I'll happilly add that functionality in. Assuming it doesn't
violate any patents of course.

Sean Hederman
http://codingsanity.blogspot.com

Jul 21 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3447
by: Harold Crump | last post by:
Greetings, I have a requirement of storing some .xml files on a web server. The files will contain financial information like credit card numbers, so I would like to encrypt them. The files will stay there until another program downloads them and deletes the files. My question is - which of the functions in the mcrypt library provide
34
4109
by: Blake T. Garretson | last post by:
I want to save some sensitive data (passwords, PIN numbers, etc.) to disk in a secure manner in one of my programs. What is the easiest/best way to accomplish strong file encryption in Python? Any modern block cipher will do: AES, Blowfish, etc. I'm not looking for public key stuff; I just want to provide a pass-phrase. I found a few modules out there, but they seem to be all but abandoned. Most seem to have died several years ago. ...
113
12339
by: Bonj | last post by:
I was in need of an encryption algorithm to the following requirements: 1) Must be capable of encrypting strings to a byte array, and decyrpting back again to the same string 2) Must have the same algorithm work with strings that may or may not be unicode 3) Number of bytes back must either be <= number of _TCHARs in * sizeof(_TCHAR), or the relation between output size and input size can be calculated simply. Has to take into account the...
1
2287
by: David | last post by:
One thing that's always puzzled me about implementing encryption on remote asp.net apps is where to store the keys. The demo code indicate that you include them in a configuration file, but this would seem to defeat the purpose. If someone obtained the configuration file and they knew the encryption method, then they could decrypt your data. Storing them hard-coded in the app is just as bad, since it can be disassembled. Obfuscation...
3
1763
by: RDI | last post by:
I'm using RSACryptoServiceProvider to encrypt data. I successfully got it to encrypt a string of less than 59 chars. Now I'm trying to handled longer strings. I was able to get it encrypt the longer strings but now I can't get it to DECRYPT the longer string. I created a string of 120 chars and it encrypted to a HUGE string. What I did was I broke the original string into indivual strings of 58 chars, encrypted them and took the...
13
1280
by: Ray Cassick \(Home\) | last post by:
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...
4
4145
by: pintu | last post by:
Hello everybody.. I hav some confusion regarding asymmetric encryption.As asymmetric encryption it there is one private key and one public key.So any data is encrypted using private key and the same is decrypted at client side using public key and vice-versa..Now i hav confusion like i.e. * Are both the keys available to both sender and receiver.? * When data is encrypted using public key ,Is the same data decrypted using private key(...
1
3080
by: =?Utf-8?B?bWljcm9ob2Y=?= | last post by:
Short version: Is there a way to configure (preferably programmatically) the max encryption strength that will be used by the framework when connecting to a particular SSL-protected web service? Long version: Historically, browsers could only be exported to certain countries if they supported only 40 and 56 bit encryption; 128 bit was restricted. I believe, based on my readings thus far, that this refers to the strength of the...
5
9527
by: Netwatcher | last post by:
well, i started messing around with dictionaries, yet, most of the pages i found about them always talk about getting only one word out of it and turning it vice versa, i've been playing with that code for a few hours: #dics Encryption={',':'hy{;',' ':'h4x0r2','':'zomg','?':'bko','a':'ika','b':'d0v','c':'ino', 'd':'maw', 'e':'aon', 'f':'que', 'g':'kip', 'h':'an', 'n':'ko print lol except KeyError: print 'These...
0
8823
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9530
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9312
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8237
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4593
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.