Unlocker Expiring Date
-
@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 thedate
)How do you use it?
-
@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-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)));
-
@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. -
@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 checkUnlocker.canExpire()
and it fails... -
@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.
-
@Christoph-Hart Investigating...
-
This post is deleted! -
@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 thecheckExpirationData
methodif
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)
-
@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']);
-
@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). -
@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 -
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 remainingI'm just lost...
-
This post is deleted! -
This post is deleted!