HISE Logo Forum
    • Categories
    • Register
    • Login

    Unlocker Expiring Date

    Scheduled Pinned Locked Moved General Questions
    15 Posts 2 Posters 556 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.
    • ustkU
      ustk
      last edited by ustk

      @Christoph-Hart I can't find the attribute name of the expiry date in Juce that is necessary in the encrypted XML data...

      I tried many things in my online generation method like expires, expiry, expiryTime, etc... with no luck -> the canExpire check returns false.

      Although when modifying the Hise Dummy license generator to use an expiry date, the check succeeds.
      So the error must be in my online generation method and probably the attribute name itself (I use a HEX as for the date)

      How do you use it?

      1 Reply Last reply Reply Quote 0
      • ustkU
        ustk
        last edited by

        @Christoph-Hart I finally found the attributes, but it's still not working 🤔

        if (xml.hasAttribute ("expiryTime") && xml.hasAttribute ("expiring_mach"))
                {
                    data.keyFileExpires = true;
                    data.machineNumbers.addArray (getMachineNumbers (xml, "expiring_mach"));
                    data.expiryTime = Time (xml.getStringAttribute ("expiryTime").getHexValue64());
                }
        

        Online:

        	$root->setAttribute("expiryTime",   $EXPIRY);
        	$root->setAttribute("expiring_mach",$MACHINE);
        
        Christoph HartC 1 Reply Last reply Reply Quote 0
        • ustkU
          ustk
          last edited by

          @Christoph-Hart And by the way this is how I make an expiry date (just for testing purpose obviously otherwise it would be renewed at each call :) )

          $nbExpirationDays = 30;
          $EXPIRY = dec2hex(round(microtime(true)*1000 + (1000*60*60*24*$nbExpirationDays)));
          
          1 Reply Last reply Reply Quote 1
          • Christoph HartC
            Christoph Hart @ustk
            last edited by

            @ustk expiryTime must be a hex encoded timestamp (in milliseconds from 1970).

            If a license key file has a expiry date, it will stay locked until you call Unlocker. checkExpirationData() with a timestring that you have encoded on your server using the RSA key from your plugin, this will be decoded in C++ and checked against the expiry date in the key file.

            ustkU 1 Reply Last reply Reply Quote 0
            • ustkU
              ustk @Christoph Hart
              last edited by

              @Christoph-Hart Hmm... So this is what I do above unless I'm wrong. I have a HEX representation of the milliseconds

              I don't use yet Unlocker.checkExpirationData() but just the check Unlocker.canExpire() and it fails...

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

                @ustk hard to guess what's wrong, I think you need to step through the debugger then to find out where it fails in the unlocked class. Just hit a breakpoint in the scripting functions and then crawl your way through it.

                ustkU 4 Replies Last reply Reply Quote 0
                • ustkU
                  ustk @Christoph Hart
                  last edited by

                  @Christoph-Hart Investigating...

                  1 Reply Last reply Reply Quote 0
                  • ustkU
                    ustk @Christoph Hart
                    last edited by ustk

                    This post is deleted!
                    1 Reply Last reply Reply Quote 0
                    • ustkU
                      ustk @Christoph Hart
                      last edited by ustk

                      @Christoph-Hart Ok I got it to work!

                      âš 
                      Although it appears that just using "0x" as argument string unlocks the product... In fact any string starting with "0x" as per the checkExpirationData method if statement will unlock successfully, returning either a delta of 19369 or 49369 days! Quite a generous demo indeed :)

                      But with the intended encrypted timestamp the method returns the expected number of days (30 in my case)

                      1 Reply Last reply Reply Quote 1
                      • ustkU
                        ustk @Christoph Hart
                        last edited by ustk

                        @Christoph-Hart I see that the substring of the encodedTimeString in Hise is:

                        bi.parseString(encodedTimeString.substring(2), 16);
                        

                        It goes up to the 16th char but shouldn't it be encodedTimeString.length()?

                        Mine has a bit more chars:

                        0x0bf63c9d8c7c71c0f0b9b8fb4b12e460c4ab3457844f9da5decc7740f6479b2b505591e35ac8d8655cc19f5fff751d5702aef9b750b1c63f161fac9d0eb2030c
                        

                        This is what/ how I encode:

                        $TIME = dechex(round(microtime(true) / 1000));
                        
                        $data['encryptedTime'] = "0x" . applyToValue($TIME, $private_keys['private_key_part1'], $private_keys['private_key_part2']);
                        
                        Christoph HartC 1 Reply Last reply Reply Quote 0
                        • Christoph HartC
                          Christoph Hart @ustk
                          last edited by

                          @ustk I think the 16 argument of the juce::BigInteger::parseString() method isn't the length but the base (so it tells it to parse it as hex number).

                          ustkU 3 Replies Last reply Reply Quote 1
                          • ustkU
                            ustk @Christoph Hart
                            last edited by ustk

                            @Christoph-Hart Oh you're right I just checked (and I obviously didn't read the code carefully as it's not part of the substring method...)
                            Wondering even more where my mistake is then 🤔

                            1 Reply Last reply Reply Quote 0
                            • ustkU
                              ustk @Christoph Hart
                              last edited by ustk

                              Alright, this is making me crazy, so I take a deep breath and try to simplify manually...

                              $TIME   = dechex(1673481600000); /* Today in ms */
                              $EXPIRY = dechex(1676160000000); /* Expiry in ms ($TIME + 30 days) */
                              
                              /* For the encodedTimeString */
                              $data['encodedTimeString'] = "0x" . applyToValue($TIME, $private_keys['private_key_part1'], $private_keys['private_key_part2']);
                              
                              /* For the XML containing the $EXPIRY (among the other things) */
                              $root->setAttribute("expiryTime",    $EXPIRY);
                              $root->setAttribute("expiring_mach", $MACHINE);
                              
                              $ENCRYPTED_XML = "#" . applyToValue($XML_STRING, $private_keys['private_key_part1'], $private_keys['private_key_part2']);
                              

                              Result from unlocker.checkExpirationData(encodedTimeString) => Unlocked with19400 days remaining

                              I'm just lost...

                              ustkU 1 Reply Last reply Reply Quote 0
                              • ustkU
                                ustk @ustk
                                last edited by ustk

                                This post is deleted!
                                1 Reply Last reply Reply Quote 1
                                • ustkU
                                  ustk @Christoph Hart
                                  last edited by

                                  This post is deleted!
                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post

                                  50

                                  Online

                                  1.7k

                                  Users

                                  11.7k

                                  Topics

                                  101.9k

                                  Posts