Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working on a piece of code which is free to use, but when a license code (or serial key or any other term like that) has been bought will remove some advertising.

The code will be freely available as open source, probably under a GPL license, but of course I would rather not have people messing around with the code that verifies the license code with an external provider.

Is there any way to legally protect this piece of code from being modified, or at least from being distributed after being modified, keeping the rest of the code "open"?

share|improve this question

migrated from Mar 8 '11 at 12:15

This question came from our site for professional and enthusiast programmers.

You could make the largest part of the code opensource, and then make the small part with the verification closed source. Of course this does mean you have to ensure that there is some crucial code in the closed part, otherwise people would just distribute the open part without it. You could for instance opensource the library, and close-source the interface part of your program.

(but to answer your question: no, that's not possible)

share|improve this answer
This also makes it either harder or impossible to use a GPL license, and reduces some of the benefits of open source. – David Thornley Mar 8 '11 at 14:44
You could double-license it. Or you could use the Lesser GPL, but of course what the OP wants is a bit against the open source mentality as well, so that you lose some benefits seems obvious. – markijbema Mar 8 '11 at 15:31

Not if the code is open source; part of the Open Source Definition is that people are allowed to modify the code and distribute their changes. Even if you included a closed-source module for the license check, people could just change the open source part to not call it.

share|improve this answer

If you consider "open source", and you still want to enable certain extra features for users that wish to pay for it, the either choose to create "nagware" or "adware" (that is, with a nag-screen or with an advertisement, annoying users and tempting them to pay for a nag- or ad-free version), or choose for a dual model, which serves the open source community and commercial firms, without the nagging.

The dual model means two things:

  • Choose an open source license that allows use of the software in copyrighted products, like the LGPL (Lesser GPL) license
  • Create two products: one open source product, like a library or basic functionality, plus an advanced product, that included paid extensions, features or enabled enterprise-usage.

You can expand on this with service contracts, of course. This model is quite widely adopted. Well known are MySql and DotNetNuke. Saxon's XSLT 2.0 processor is another example (XSLT-B processor is open source, XSLT-SA processor is payware, the second being built on top of the first).

share|improve this answer

Didn't etexteditor as far as I remember, did something similar? They open sourced their code while keeping a small part closed.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.