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.
    • 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
        • staiffS
          staiff
          last edited by staiff

          ok

          actually compiling the latest hise standalone project.

          if i understand well i also could add the SerialGenerator.js script to the interface to generate a brand new serial list instead of the given one ?

          all the component are labels (save in preset no, and just the input serial editable) ? except the Submibutton of course ;)

          EDIT:
          Just added this line:
          Description.set("text", "Valid serial number. The number you supplied does match");
          in :
          if(serials.Data.contains(v))
          {
          Console.print("Serial number found");
          Description.set("text", "Valid serial number. The number you supplied does match");

          Because without that it always shows that it's invalid in the Description Label. :D

          Excuse me i'm French.

          1 Reply Last reply Reply Quote 0
          • JayJ
            Jay
            last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • JayJ
              Jay
              last edited by

              You are the BEST @Christoph-Hart , Thanks

              1 Reply Last reply Reply Quote 0
              • staiffS
                staiff
                last edited by

                Just a little funny test :)
                simple & basic scripting, just for test.
                Serial_test.gif
                Sorry no sound in gif but it works !

                :D :D :D

                Excuse me i'm French.

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

                  @Christoph-Hart OK quick supplemental question - has "today's HISE" fixed the problem of dialogs not showing fully in interfaces less than 500 px high or do I have to go modify my UI design a bit?

                  HISE Development for hire.
                  www.channelrobot.com

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

                    @Lindon dont worry - answered it myself - no.

                    HISE Development for hire.
                    www.channelrobot.com

                    1 Reply Last reply Reply Quote 0
                    • staiffS
                      staiff
                      last edited by

                      will try to find how add user name (with a print as "registered to: "name of user")

                      it could be good No ?

                      Excuse me i'm French.

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

                        How about a bundle products? For example a bundle that consists of 20 different plugins.

                        Any suggestions for preventing the user from entering serials of the 20 products one by one?

                        develop Branch / XCode 13.1
                        macOS Monterey / M1 Max

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

                          Store the entered serial one parent directory up. In HISE this will be superweird but the compiled version will end up in your Company folder (you might need to add a bundle ID to the JSON you store on disk)

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

                            Ok I see, I set 2 folders up from the root folder:

                            "../../RegistrationInfo.js"
                            

                            develop Branch / XCode 13.1
                            macOS Monterey / M1 Max

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

                              Yes, but choose a filename that won't conflict with other bundles you might offer :)

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

                                @Christoph-Hart Good idea ;)

                                develop Branch / XCode 13.1
                                macOS Monterey / M1 Max

                                1 Reply Last reply Reply Quote 0
                                • resonantR
                                  resonant @Lindon
                                  last edited by

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

                                  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...

                                  Is there any progress for this serial decoder formula stuff?

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

                                    No and there never will be. As soon as you use a publicly available "formula" to create these serials, your entire copy protection scheme is pointless.

                                    Use the tools and come up with a random processing and combination of the things to create valid serials. Then tell nobody how you did it :)

                                    d.healeyD orangeO 2 Replies Last reply Reply Quote 1
                                    • d.healeyD
                                      d.healey @Christoph Hart
                                      last edited by

                                      @Christoph-Hart

                                      No and there never will be. As soon as you use a publicly available "formula" to create these serials, your entire copy protection scheme is pointless

                                      I came up with such a scheme for Kontakt. The formula can be made public as it relies on each instrument containing a unique number in its script that is used to encode/decode the serials. I'll post the script when I'm at my computer.

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

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

                                        @Christoph-Hart Yes of course the formula shouldn't be shared. And I think without formula method is useful too.

                                        develop Branch / XCode 13.1
                                        macOS Monterey / M1 Max

                                        d.healeyD 1 Reply Last reply Reply Quote 1
                                        • resonantR
                                          resonant
                                          last edited by

                                          @Christoph-Hart I mean how can we approach this encoding and decoding process..etc. I've found this could it be useful? : https://gist.github.com/ubergesundheit/5626679

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

                                            Yeah, good luck pasting throw new RuntimeException("VIN number must be 17 characters"); into HISE :)

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

                                            50

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            101.8k

                                            Posts