HISE Logo Forum
    • Categories
    • Register
    • Login

    Simple copy protection done right :)

    Scheduled Pinned Locked Moved Presets / Scripts / Ideas
    151 Posts 25 Posters 17.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Christoph HartC
      Christoph Hart
      last edited by

      Hi everybody,

      inspired by @Lindon's remarkable efforts to wrap a copy protection system into the user preset system, I decided to make a example project that uses an intermediate file in the app data folder for checking whether the plugin is authorised correctly.

      I slapped this together in about 30 minutes, so if you spot anything stupid let me know, but this project should get the most people started with a really simple copy protection scheme.

      Link Preview Image
      hise_tutorial/SimpleCopyProtection at master · christophhart/hise_tutorial

      The Tutorial project for HISE. Contribute to christophhart/hise_tutorial development by creating an account on GitHub.

      favicon

      GitHub (github.com)

      d.healeyD orangeO Dan KorneffD LindonL 4 Replies Last reply Reply Quote 7
      • d.healeyD
        d.healey @Christoph Hart
        last edited by

        @Christoph-Hart make it a valid Javascript file by pretending
        I think that should read prepending :)

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        Christoph HartC 1 Reply Last reply Reply Quote 1
        • orangeO
          orange @Christoph Hart
          last edited by

          @Christoph-Hart You are awesome, thank you!!

          develop Branch / XCode 13.1
          macOS Monterey / M1 Max

          1 Reply Last reply Reply Quote 1
          • Christoph HartC
            Christoph Hart @d.healey
            last edited by

            @d-healey make a pull request ;)

            1 Reply Last reply Reply Quote 2
            • orangeO
              orange
              last edited by

              World's fastest copy protection creating process (in 30 min.). Speedart :) :)

              develop Branch / XCode 13.1
              macOS Monterey / M1 Max

              1 Reply Last reply Reply Quote 0
              • Dan KorneffD
                Dan Korneff @Christoph Hart
                last edited by

                @Christoph-Hart thanks so much!

                Dan Korneff - Producer / Mixer / Audio Nerd

                1 Reply Last reply Reply Quote 0
                • ossian1961O
                  ossian1961
                  last edited by

                  Light speed!!! Thanks !!!! :)

                  https://www.kontakthub.com/label/Imagik-Sound/
                  https://mirtklaar.bandcamp.com/

                  1 Reply Last reply Reply Quote 0
                  • LindonL
                    Lindon @Christoph Hart
                    last edited by

                    @Christoph-Hart said in Simple copy protection done right :):

                    Hi everybody,

                    inspired by @Lindon's remarkable efforts to wrap a copy protection system....

                    remarkable only in the level of doofus inability to work things out by me really....

                    HISE Development for hire.
                    www.channelrobot.com

                    1 Reply Last reply Reply Quote 0
                    • LindonL
                      Lindon
                      last edited by

                      "we use the Engine.dumpAsJSON() method to just store their entered serial to a file which is loaded every time the plugin is instanciated."

                      The only additional thing I usually do is obfuscate this "number" - put it at random spots in a inside a 60 digit sequence - 9's complement - that sort of stuff... but that might be a little paranoid on my part.

                      HISE Development for hire.
                      www.channelrobot.com

                      d.healeyD 1 Reply Last reply Reply Quote 0
                      • d.healeyD
                        d.healey @Lindon
                        last edited by

                        @Lindon

                        The only additional thing I usually do is obfuscate this "number"

                        What purpose does that serve?

                        Libre Wave - Freedom respecting instruments and effects
                        My Patreon - HISE tutorials
                        YouTube Channel - Public HISE tutorials

                        LindonL 1 Reply Last reply Reply Quote 0
                        • LindonL
                          Lindon @d.healey
                          last edited by Lindon

                          @d-healey it makes me feel good....☺

                          Actually I dont store all the numbers in the interface - I use an formula to calc if the entered numbers are valid or not...Kontakt is so much easier to hack the (KSP) code so including the numbers was never really an option. HISE not so much of a problem. One more win for HISE...

                          HISE Development for hire.
                          www.channelrobot.com

                          orangeO resonantR 2 Replies Last reply Reply Quote 1
                          • orangeO
                            orange @Lindon
                            last edited by orange

                            @Lindon Any good hacker can hack everything. If you don't use advanced challenge system (that requires taking machine ID and checks / registers online status...etc) they can hack everything including live serial generation formula system... So, this Serial protection with formula system has the same risks with "Simple Copy Protection" solution...

                            develop Branch / XCode 13.1
                            macOS Monterey / M1 Max

                            d.healeyD 1 Reply Last reply Reply Quote 0
                            • d.healeyD
                              d.healey @orange
                              last edited by

                              @orange That's not the point of this.

                              Libre Wave - Freedom respecting instruments and effects
                              My Patreon - HISE tutorials
                              YouTube Channel - Public HISE tutorials

                              orangeO 1 Reply Last reply Reply Quote 0
                              • orangeO
                                orange @d.healey
                                last edited by

                                @d-healey So, this Serial protection with formula system has the same risks with "Simple Copy Protection" solution...

                                develop Branch / XCode 13.1
                                macOS Monterey / M1 Max

                                d.healeyD 1 Reply Last reply Reply Quote 0
                                • d.healeyD
                                  d.healey @orange
                                  last edited by

                                  @orange said in Simple copy protection done right :):

                                  @d-healey So, this Serial protection with formula system has the same risks with "Simple Copy Protection" solution...

                                  This is not designed to be a super secure copy restriction system, it is designed as a sharing deterrent for regular none techy users.

                                  Libre Wave - Freedom respecting instruments and effects
                                  My Patreon - HISE tutorials
                                  YouTube Channel - Public HISE tutorials

                                  orangeO 1 Reply Last reply Reply Quote 0
                                  • orangeO
                                    orange @d.healey
                                    last edited by

                                    @d-healey Yes I am saying the same thing ;)

                                    develop Branch / XCode 13.1
                                    macOS Monterey / M1 Max

                                    1 Reply Last reply Reply Quote 1
                                    • Christoph HartC
                                      Christoph Hart
                                      last edited by

                                      Actually I dont store all the numbers in the interface - I use an formula to calc if the entered numbers are valid or not...Kontakt is so much easier to hack the (KSP) code so including the numbers was never really an option. HISE not so much of a problem. One more win for HISE...

                                      Yes, if you come up with a way to validate serials without storing strings in the binary, you solve a few issues of this approach:

                                      • if you run out of serials, you have to reencode the plugin (or choose a big enough serial amount in the first place)
                                      • smaller footprint and compile time (creating more than a few thousand strings will defer the plugin start for your user)

                                      There aren't too much security features in HISEScript, but you can use one of these tricks:

                                      • create the sum (poor man's hash) of the string character values and make sure it matches a rule you define.
                                      • disallow certain characters
                                      • any kind of cheap encryption algorithm should be enough.

                                      This function can be used to create a "hash" from a string:

                                      const var s = "ABCD";
                                      
                                      var x = 0;
                                      
                                      inline function createHash(text)
                                      {
                                          local sum = 0;
                                          
                                          for(i = 0; i < text.length; i++)
                                          {
                                              sum += text.charCodeAt(i);
                                          }
                                          
                                          return sum;
                                      }
                                      
                                      x = createHash(s);
                                      
                                      ? 1 Reply Last reply Reply Quote 0
                                      • staiffS
                                        staiff
                                        last edited by staiff

                                        with hise 1.6 it crash
                                        hise 2.00 nothing to see in the interface.

                                        "Interface:! onControl could not be parsed!"

                                        normal ?

                                        Excuse me i'm French.

                                        orangeO 1 Reply Last reply Reply Quote 0
                                        • orangeO
                                          orange @staiff
                                          last edited by orange

                                          @staiff in
                                          Use the latest (updated today) HISE version.
                                          Use Authorisation.js code with Content.makeFrontInterface like below. Also don't forget to include("Serials.js") to make the function check. All of the UI elements will be activated. I tried and compiled a plugin, it works likea charm. It creates "RegistrationInfo.js" in User presets main folder. Interface code example is this;

                                          Content.makeFrontInterface(600, 500);
                                          
                                          
                                          include("Serials.js");
                                          
                                          
                                          
                                          namespace Authorisation
                                          {
                                              const var SerialInput = Content.getComponent("SerialInput");
                                              const var Description = Content.getComponent("Description");
                                              const var SerialStateLabel = Content.getComponent("SerialStateLabel");
                                              const var AuthorisationDialogue = Content.getComponent("AuthorisationDialogue");
                                              const var GlobalMute = Synth.getMidiProcessor("GlobalMute");
                                              
                                              /** Checks if the serial input is valid and stores the result if successful. */
                                              inline function onSubmitButtonControl(component, value)
                                              {
                                                  if(!value) // Just execute once
                                                      return;
                                              
                                                  local v = SerialInput.getValue();
                                                  Console.print(v);
                                          	
                                                  // Checks if it's in the input
                                                  if(serials.Data.contains(v))
                                                  {
                                                      Console.print("Serial number found");
                                                  
                                                      local data = 
                                                      {
                                                          "Serial": v
                                                      };
                                                  
                                                      // Stores the file to the hard drive. In HISE it will be the project folder
                                                      // but in the compiled plugin it will use the parent directory to the 
                                                      // user preset directory (which is usually the app data folder).
                                                      Engine.dumpAsJSON(data, "../RegistrationInfo.js");
                                                      
                                                      setValidLicense(true);
                                                  }
                                                  else
                                                  {
                                                      Console.print("Invalid serial number");
                                                      Description.set("text", "Invalid serial number. The number you supplied does not match");
                                                      
                                                      setValidLicense(false);
                                                  }
                                              };
                                          
                                              Content.getComponent("SubmitButton").setControlCallback(onSubmitButtonControl);
                                          
                                          
                                              inline function setValidLicense(isValid)
                                              {
                                                  // Do whatever you want to do here. I suggest a MIDI muter...
                                                  GlobalMute.setAttribute(0, 1 - isValid);
                                              
                                                  if(isValid)
                                                  {
                                                      // Change this to any other visual indication...
                                                      SerialStateLabel.set("bgColour", Colours.greenyellow);
                                                      AuthorisationDialogue.set("visible", false);
                                                  }
                                                  else
                                                  {
                                                      SerialStateLabel.set("bgColour", Colours.red);
                                                      AuthorisationDialogue.set("visible", true);
                                                  }
                                              }
                                          
                                              inline function checkOnLoad()
                                              {
                                                  // Clear the input
                                                  SerialInput.set("text", "");
                                                  
                                                  // Load the serial from the stored file
                                                  local pData = Engine.loadFromJSON("../RegistrationInfo.js");
                                                  Console.print("Checking serial");
                                              
                                                  if(pData)    
                                                  {
                                                      local v = pData.Serial;
                                                      Console.print("Restored serial: " + v);
                                                  
                                                      if(serials.Data.contains(v))
                                                      {
                                                          setValidLicense(true);
                                                          return;
                                                      }
                                                  }
                                              
                                                  setValidLicense(false);
                                              }
                                          
                                              // Call this on startup
                                              checkOnLoad();
                                          
                                          }
                                          

                                          develop Branch / XCode 13.1
                                          macOS Monterey / M1 Max

                                          L ? 2 Replies Last reply Reply Quote 0
                                          • Christoph HartC
                                            Christoph Hart
                                            last edited by

                                            Yes you need today's HISE version, I changed the behaviour of the Engine.loadJSON() method to return undefined instead of throwing an error (which will be the default case if the file wasn't written yet).

                                            LindonL 1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post

                                            44

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            101.8k

                                            Posts