LicenceDomain
Description
The LicenceDomain class represents the client-side functionality of a licence domain.
Public / Methods
Check
This is a convenience method that generates a licence request and outputs some helpful log messages when this licence domain is still locked.
The following log messages are output to Logger when still locked:
-
If AllowUnlockByEnvironment is
true:
LogMessage_Check_Environment -
If AllowUnlockByUserKeyFile is
true:
LogMessage_Check_UserKeyFile -
If AllowUnlockByApplication is
falseor LowLevel.IsDebug istrue:
LogMessage_Metadata_Machine
Otherwise:
LogMessage_Metadata
If the licence domain is still locked, a licence request is generated in the user home directory with Request1.
- See also
GenerateLicenceKeySetup
Generates a source code fragment for C# resp. C++ which reconstructs a licence key string using some pseudo-random arithmetic.
You can use the source code fragment if you do not want to embed the licence key as a string literal into your binary.
The C# code fragment looks like this:
// CODEX-GENERATOR-BEGIN(Tinman.Core.Licensing.LicenceDomain)
// Tinman 3D licence key:
// CIk!6Dh6Ui;lSE+Z{{jx7$Y~8,#TSt~o%CK#(e,F#O9.d;fGc+bU35%HVl;[.+s#@h.bo1~{riL.4|UreHfeuac}5ZV~DBocxU}@
{
sbyte[] licenceKeyData;
licenceKeyData = new sbyte[N+1];
licenceKeyData[0] = ?;
licenceKeyData[1] = (sbyte) (licenceKeyData[0] op ?);
...
licenceKeyData[N] = (sbyte) (licenceKeyData[N-1] op ?);
licenceKey = global::Tinman.Core.StringUtil.BinaryDecode(licenceKeyData);
}
// CODEX-GENERATOR-END(Tinman.Core.Licensing.LicenceDomain)
The C++ code fragment looks like this:
// CODEX-GENERATOR-BEGIN(Tinman.Core.Licensing.LicenceDomain)
// Tinman 3D licence key:
// CIk!6Dh6Ui;lSE+Z{{jx7$Y~8,#TSt~o%CK#(e,F#O9.d;fGc+bU35%HVl;[.+s#@h.bo1~{riL.4|UreHfeuac}5ZV~DBocxU}@
{
CodeX::Array<int8> licenceKeyData(N+1);
licenceKeyData[0] = ?;
licenceKeyData[1] = static_cast<CodeX::int8> (licenceKeyData[0] op ?);
...
licenceKeyData[N] = static_cast<CodeX::int8> (licenceKeyData[N-1] op ?);
licenceKey = ::Tinman::Core::StringUtil::BinaryDecode(licenceKeyData);
}
// CODEX-GENERATOR-END(Tinman.Core.Licensing.LicenceDomain)
where 'licenceKey' is the variable name that has been specified via the variableName opt parameter, N+1 is the buffer length and op and ? perform pseudo-random arithmetic operations.
LicenceKey
Specifies a licence key that shall be used to unlock this licence domain.
Each licence key is a string of 100 characters, interpreted as a base-85 number using printable ASCII characters as digits (whitespaces are ignored). These characters will never be used in a licence key string:
"&'/<>\]`
This allows licence keys to be put into string literals or XML files, see LicenceKeyNormalize for additional information. Here is an example key:
CIk!6Dh6Ui;lSE+Z{{jx7$Y~8,#TSt~o%CK#(e,F#O9.d;fGc+bU35%HVl;[.+s#@h.bo1~{riL.4|UreHfeuac}5ZV~DBocxU}@
Please note that the example key above is invalid. You must specify at least one valid one before using the Tinman 3D SDK.
An application can specify any number of licence keys. Upon first call to Unlock request, the licence domain is unlocked; for this at least one valid licence key must have been specified. All invalid licence keys are ignored silently.
A licence key can optionally be specified via a user environment variable named {NAME}_LICENCEKEY, where {NAME} is the value of Name, converted to uppercase. Licence keys specified via LicenceKey have precedence over the environment variable key.
LicenceKeyEscape
Returns a StringEscape object that can be used to create modified licence keys, as described by see LicenceKeyNormalize.
LicenceKeyNormalize
Normalizes the given licence key string.
A licence key is normalized like this:
-
The following character substitutions are performed on the given licence key string:
'&' => '#' '"' => '(' '\'' => '(' '/' => '$'This makes sure that a modified licence key string can be put into the
/etc/environmentor~/.profilefile of a Unix/Linux system:-
Avoid truncation of licence key after special comment character
'#'. -
Avoid breaking of command
'apt upgrade', because of unexpected'('character. -
Avoid wrong interpretation of
…$abc…as a variable.
-
-
All invalid characters are discarded (i.e. all non-base-85 characters).
This will remove all whitespaces resp. line-breaks (e.g. resulting from copy & paste). -
If the resulting string length is not 100, the entire string is discarded and set to
null.
- See also
Request
2 overloads
Formulates a licence request for this licence domain.
The licence request is a human-readable JSON value (see JsonValue.From1). The licence request file is a text file with UTF-8 encoding (see CharacterEncoding.UTF_8) and leading byte-order marks.
When a licence key is granted for the returned request, it will allow the enclosing environment (see LicenceFlags) to activate this licence domain.
- IOException
-
If an I/O error has occurred.
Formulates a licence request for this licence domain.
The licence request is a human-readable JSON value (see JsonValue.From1). The licence request file is a text file with UTF-8 encoding (see CharacterEncoding.UTF_8) and leading byte-order marks.
When a licence key is granted for the returned request, it will allow the enclosing environment (see LicenceFlags) to activate this licence domain.
- IOException
-
If an I/O error has occurred.
TryUnlock
Checks if this licence domain has been unlocked.
When this licence domain is still unlocked, the method will try to unlock it using the set of specified licence keys (see LicenceKey). On success, the method will output LogMessage_Licence_Success and the program will continue to execute normally. On failure, LogMessage_Licence_Invalid will be output for each licence key that failed to unlock this domain and an exception will be thrown.
Unlock
Checks if this licence domain has been unlocked.
When this licence domain is still unlocked, the method will try to unlock it using the set of specified licence keys (see LicenceKey). On success, the program will continue to execute normally. On failure, an exception will be thrown.
- LicenceException
-
If this licence domain is still locked.
UnlockContent
Unlocks a protected content file.
The unlocked content will be written to a file having the same path as content in, without the file suffix: '.lic'.
- IOException
-
If an I/O error has occurred.
UnlockInt32s
Unlocks a protected integer array.
- LicenceException
-
If this licence domain is still locked.
UnlockInt8s
Unlocks a protected byte array.
- LicenceException
-
If this licence domain is still locked.
UnlockString
Unlocks a protected string value.
- LicenceException
-
If this licence domain is still locked.
Public / Attributes
AllowUnlockByApplication
Allow this licence domain to be unlocked via licence keys that are specified with LicenceKey?
After the licence domain has been unlocked, setting this property has no longer any effect.
Defaults to true.
AllowUnlockByEnvironment
Allow this licence domain to be unlocked via the licence key found in the environment variable?
After the licence domain has been unlocked, setting this property has no longer any effect.
Defaults to true.
AllowUnlockByUserKeyFile
Allow this licence domain to be unlocked via the licence key found in the user key file?
After the licence domain has been unlocked, setting this property has no longer any effect.
Defaults to false.
IsUnlocked
Has this licence domain been unlocked?
The TryUnlock method is not called when this property is get.
IsUnlockedByApplication
Is this licence domain being activated from one of the licence keys that have been specified via LicenceKey?
The TryUnlock method is called each time this property is get.
IsUnlockedByEnvironment
Is this licence domain being activated from the licence key that has been specified in the environment variable (see NameEnvironment)?
The TryUnlock method is called each time this property is get.
IsUnlockedByUserKeyFile
Is this licence domain being activated from the licence key that has been specified in the user key file (see NameUserKeyFile)?
The TryUnlock method is called each time this property is get.
NameEnvironment
Returns the name of the environment variable that can be used to specify a licence key for this domain.
NameUserKeyFile
Returns the full path of the user key file that can be used to specify a licence key for this domain.
Tinman
The licence domain of the Tinman 3D SDK (tinman_3d).
To obtain a new licence manually, you can use the Request2 and Request1 methods in your application to generate a licence request. Include the licence request file in your email to sales@tinman3d.com and we will be happy to complete your licence request. If you have any other questions, please send an email to: info@tinman3d.com.
According to LicenceKey, the environment variable for the Tinman 3D SDK is this:
TINMAN_3D_LICENCEKEY = ...
Logging
Logger
The logger object of this class.
- See also
-
LicenceDomain.LogMessage_Check_Environment
LicenceDomain.LogMessage_Check_UserKeyFile
LicenceDomain.LogMessage_Licence_Failure
LicenceDomain.LogMessage_Licence_Invalid
LicenceDomain.LogMessage_Licence_Success
LicenceDomain.LogMessage_Metadata
LicenceDomain.LogMessage_Metadata_Machine
LicenceDomain.LogMessage_Request
LogMessage_Check_Environment
Advises the user to check the licence key in environment variable.
Label parameters:
#0 :
Name of the environment variable, see NameEnvironment.
- See also
LogMessage_Check_UserKeyFile
Advises the user to check the licence key in the user key file.
Label parameters:
#0 :
Path to the user key file, see NameUserKeyFile.
- See also
LogMessage_Licence_Failure
The licence domain cannot be unlocked because there is no valid licence key.
Label parameters:
#0 :
Name of the licence domain, Name.
- See also
LogMessage_Licence_Invalid
A well-formed licence key (according to LicenceKeyNormalize) has been specified which did not activate the licence domain.
Label parameters:
#0 :
The first 12 characters of the invalid licence key.
- See also
LogMessage_Licence_Success
The licence domain has been unlocked from a licence key.
Label parameters:
#0 :
The source of the licence key (application, environment, user key file).
- See also
LogMessage_Metadata
Outputs the current licence metadata.
Label parameters:
#0 : LicenceMetadata.LegalCompany
#1 : LicenceMetadata.LegalCopyright
#2 : LicenceMetadata.LegalProduct
#3 : LicenceMetadata.LegalTrademark
#4 : LicenceMetadata.MachineCode
#5 : LicenceMetadata.MachineDomain
#6 : LicenceMetadata.MachineUser
#7 : LicenceMetadata.ProgramFile
#8 : LicenceMetadata.ProgramHash
#9 : LicenceMetadata.ProgramTitle
#10 : LicenceMetadata.ProgramVersion
- See also
LogMessage_Metadata_Machine
Outputs the licence metadata.
Label parameters:
#4 : LicenceMetadata.MachineCode
#5 : LicenceMetadata.MachineDomain
#6 : LicenceMetadata.MachineUser
- See also
LogMessage_Request
Outputs the file path to the generated licence request file.
Label parameters:
#0 :
Path to the licence request file, as returned by Request1.
- See also