
Don't let your customers have it. That is the only way.
Those are all very different things. In general though, you should not
spend very much time on that sort of thing. Unless you follow the
previous advice and do not even allow access to your code by customers,
no amount of work will prevent your program from being hacked.
So, spend a small amount of time implementing something simple, and easy
enough to do that the chance of a bug that would affect a paying
customer is practically nil, and call it good.
One common, low-cost approach is to come up with a compact data
structure that encodes your licensing limits (date, concurrent users,
etc. all along with some unique ID for the user), then encrypt that and
make that the product key.
Of course, you need to make sure that you do not try to pack too much
data into the key, otherwise it is lengthy and difficult for a user to
enter when they are not able to copy/paste (from web page, email, etc.).
But that is just good business sense anyway; you do not really want a
very complicated licensing scheme, regardless.
With the encrypted key, then your program simply has to decrypt it when
it runs, and use the data contained within to control how it executes.
A competent hacker will break through a system like that in under an
hour (they will simply modify your program so that the license terms they
want are hard-coded in the program). But you are not going to protect
your code from a competent hacker anyway. The real goal is just to help
the usual users stay honest.
Finally, note that even this minimal amount of DRM might not be required
or helpful to you (it is definitely not helpful to your users).
Recently, an e-book publisher (O'Reilly, I think) released sales figures
for their books after they removed all DRM from them. Their sales
_increased_ as compared to with-DRM by over 100%. No doubt, much of
that increase is due to factors other than the change in DRM, but the
point is that not having any DRM on their trivially-copied books did not
_inhibit_ the growth of their sales significantly either.
Pete