Platforms to show: All Mac Windows Linux Cross-Platform

Back to SGLockMBS module.

SGLockMBS.Authenticate(AuthentCode as MemoryBlock)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Dongle MBS Dongle Plugin 18.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Authentication of SG-Lock library to the protected application and vice versa.

This function of the SG-Lock API has to be called once first and successfully to enable all other API functions. In the case of dynamic linking the authentication is required after every link procedure (LoadLibrary call).

Every customer get his unique Authentcode when purchasing SG-Lock (non Demo) the first time. Demo kits have an own authentication code (see example source code files).

AuthentCode: 48 byte sequence, that is unique to every SG-Lock customer. As array, it's 12 values in the array.

Lasterror is set to kErrorSuccess on success and an error code otherwise.

See also:

SGLockMBS.Authenticate(AuthentCode() as UInt32)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Dongle MBS Dongle Plugin 18.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Authentication of SG-Lock library to the protected application and vice versa.

This function of the SG-Lock API has to be called once first and successfully to enable all other API functions. In the case of dynamic linking the authentication is required after every link procedure (LoadLibrary call).

Every customer get his unique Authentcode when purchasing SG-Lock (non Demo) the first time. Demo kits have an own authentication code (see example source code files).

AuthentCode: 48 byte sequence, that is unique to every SG-Lock customer. As array, it's 12 values in the array.

Lasterror is set to kErrorSuccess on success and an error code otherwise.

See also:

SGLockMBS.CloseLibrary

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Dongle MBS Dongle Plugin 18.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Unloads and closes DLL.

SGLockMBS.CryptLock(ProductId as UInt32, KeyNum as UInt32, CryptMode as UInt32, Data as MemoryBlock) as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Dongle MBS Dongle Plugin 18.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Encrypts or decrypts data on the dongle.

En- or decrypts one or more 64-bit data blocks with 128-bit key. The crypto- graphic algorithm is TEA.

ProductId: Indicates the ProductId of the SG-Lock
KeyNum: Number of key to use 0 to 1 - SG-Lock U3 0 to 15 - SG-Lock U4
CryptMode: Working mode. kCryptModeEncrypt = 0 for Encrypt, kCryptModeDecrypt = 1 for Decrypt.
Data: Input data. Should be multiply of 4 in length.

Returns the output data.

Lasterror property is set.

Some examples using this method:

SGLockMBS.LoadLibraryFile(File as folderItem) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Dongle MBS Dongle Plugin 18.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Loads the dll/dylib/so file at the give path.

Returns true on success or false on failure.
Please call once on app startup to load library.
Sets LibraryError property in case of error.

SGLockMBS.LoadLibraryPath(Path as String) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Dongle MBS Dongle Plugin 18.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Loads the dll/dylib/so file at the give path.

Returns true on success or false on failure.
Please call once on app startup to load library.
Sets LibraryError property in case of error.

SGLockMBS.ReadConfig(ProductId as UInt32, Category as UInt32 = 0) as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Dongle MBS Dongle Plugin 18.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Reads configuration information about SG-Lock.

ProductId: Indicates the ProductId of the SG-Lock
Category: Type of requested information. currently only 0 for Information about SG-Lock modul.

Returns memoryblock with an array of 8 integers of 32-bit. The meaning of the single values are:

Index 0: Type
Index 1: Interface
Index 2: Software Version
Index 3: Hardware Version
Index 4: Serial number
Index 5: Memory size in Dwords
Index 6: Number of counters
Index 7: Number of 128-Bit Keys

Updates HardwareVersion, CounterCount, KeyCount, MemorySize, MemorySizeBytes, SerialNumber, SoftwareVersion, Type and InterfaceType properties.

Lasterror is set.

Some examples using this method:

SGLockMBS.ReadCounter(ProductId as UInt32, CntNum as UInt32) as UInt32

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Dongle MBS Dongle Plugin 18.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Reads a 32-bit count value from the SG-Lock memory.

ProductId: Indicates the ProductId of the SG-Lock
CntNum: Number of counter, 0 to 15 - SG-Lock U3 0 to 63 - SG-Lock U4

Returns the value read.
Lasterror property is set.

Counters are simple 32 bit data values in the SG-Lock memory. If desired, they can also be used for everything a 32 bit read/write variable is suitable for. By doing so you can extend the general purpose memory over the indicated size.

SGLockMBS.ReadData(ProductId as UInt32, Address as UInt32, LongCount as UInt32) as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Dongle MBS Dongle Plugin 18.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Read 32-bit data from the SG-Lock memory.

ProductId: Indicates the ProductId of the SG-Lock
Address: Startadress of data value block 0 to 63 - SG-Lock U3 or 0 to 255 - SG-Lock U4
Count: Number of data values to read, each 4 bytes.

Returns memoryblock with data values.
Lasterror property is set.

SGLockMBS.ReadProductId as UInt32

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Dongle MBS Dongle Plugin 18.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Reads the 16-bit ProductId from the SG-Lock.

Lasterror property is set.

The ProductId is an identifier that eases to distinguish between different protected applications of SG-Lock users. For example company X protects its application A and B with SG-Lock and gives all keys for application A the ProductId 1 and the keys for application B the ProductId 2, then all keys of application B are ”hidden“ for application A and vice versa. This simple mechanism offers an effective way to prevent confusion between keys of different applications. Setting of the ProductId should be integrated into the initial- ization process of the SG-Locks before distributing with the protected software.

Returns the ProductId assigned to dongle.
Lasterror is set.

SGLockMBS.ReadSerialNumber(ProductId as UInt32) as UInt32

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Dongle MBS Dongle Plugin 18.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Reads the for every SG-Lock unique serial number.

ProductId: Indicates the ProductId of the SG-Lock

Returns the serial number will be given back to the calling application

Lasterror property is set.

Every SG-Lock has a serial number that is unique, which is also not depending on type and interface.

Some examples using this method:

SGLockMBS.SearchLock(ProductId as UInt32) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Dongle MBS Dongle Plugin 18.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Searches for a SG-Lock device.

ProductId: Indicates the ProductId of the SG-Lock looked for

Updates HardwareVersion, CounterCount, KeyCount, MemorySize, MemorySizeBytes, SerialNumber, SoftwareVersion, Type and InterfaceType properties.

Some examples using this method:

SGLockMBS.SignData(ProductId as UInt32, AppSignKey as MemoryBlock, LockSignKeyNum as UInt32, LockSignInterval as UInt32 = 0, Data as MemoryBlock) as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Dongle MBS Dongle Plugin 18.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Signs the data.

The task will will be processed by the SG-Lock and if desired also by the application (PC-CPU) to accelerate the signing process (combined mode). Important condition for combined mode: Both keys (application and SG-Lock internal) have to be different, to ensure highest security! The signature is 64-bit long.

ProductId: Indicates the ProductId of the SG-Lock
AppSignKey: The 128-bit key used by the application for sign- ing and verification. Pointer to an array of 4 in- teger values of 32-bit. Only needed in combined mode otherwise set 0.
LockSignKeyNum: Number of 128-bit key in SG-Lock for signing and verification.
LockSignInterval: Indicates the partitioning of computing power between SG-Lock and application (PC-CPU). 0 is SG-Lock only. If >0 the value is used as the power of 2, where the result of that determines which block index is signed or verified by the SG-Lock. E.g. value= 8, 28ˆ=256, that means the first and after that every 256th block is processed by the SG-Lock and all others by the application (PC-CPU). That means 1/256= 0.4% of the task is done by the SG-Lock and 99.6% by the PC- CPU. The result is a very high acceleration of the process.
Data: Pointer to the memoryblock with of 32-bit values to sign or verify.

Returns signature as memoryblock.

Lasterror property is set.

The same value for the parameter LockSignInterval has to be used for signing and verifying a certain data block, when using different 128-bit keys in the SG-Lock and application (highly recommended for highest security). The reasons is, that the 128-bit key in the application is less safe than the 128-bit key in the SG-Lock. When a hacker succeeds to investigate the 128-bit key in the application (which is in principle possible), then he will try that also first for the SG-Lock. That will fail, if a differnt 128-bit key is used in the SG-Lock. For a deeper understanding of the function, please take a look into the SG-Lock include/header file for your programming language. You will find the source code of the function in it.

SGLockMBS.TeaDecipher(data as MemoryBlock, Key as MemoryBlock) as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Dongle MBS Dongle Plugin 18.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Decrypt data.

Encryption happens in plugin using sample code from SG.
Data is memoryblock with 8 bytes of data.
Key is memoryblock with 16 bytes in size.

Lasterror property is set.

SGLockMBS.TeaEncipher(data as MemoryBlock, Key as MemoryBlock) as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Dongle MBS Dongle Plugin 18.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Encrypt data.

Encryption happens in plugin using sample code from SG.
Data is memoryblock with 8 bytes of data.
Key is memoryblock with 16 bytes in size.

Lasterror property is set.

Some examples using this method:

SGLockMBS.VerifyData(ProductId as UInt32, AppSignKey as MemoryBlock, LockSignKeyNum as UInt32, LockSignInterval as UInt32 = 0, Data as MemoryBlock, Signature as MemoryBlock) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Dongle MBS Dongle Plugin 18.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Verifies the signature with the data.

The task will will be processed by the SG-Lock and if desired also by the application (PC-CPU) to accelerate the signing process (combined mode). Important condition for combined mode: Both keys (application and SG-Lock internal) have to be different, to ensure highest security! The signature is 64-bit long.

ProductId: Indicates the ProductId of the SG-Lock
AppSignKey: The 128-bit key used by the application for sign- ing and verification. Pointer to an array of 4 in- teger values of 32-bit. Only needed in combined mode otherwise set 0.
LockSignKeyNum: Number of 128-bit key in SG-Lock for signing and verification.
LockSignInterval: Indicates the partitioning of computing power between SG-Lock and application (PC-CPU). 0 is SG-Lock only. If >0 the value is used as the power of 2, where the result of that determines which block index is signed or verified by the SG-Lock. E.g. value= 8, 28ˆ=256, that means the first and after that every 256th block is processed by the SG-Lock and all others by the application (PC-CPU). That means 1/256= 0.4% of the task is done by the SG-Lock and 99.6% by the PC- CPU. The result is a very high acceleration of the process.
Data: Pointer to the memoryblock with of 32-bit values to sign or verify.
Signature: The signature as memory block.

Lasterror property is set.

The same value for the parameter LockSignInterval has to be used for signing and verifying a certain data block, when using different 128-bit keys in the SG-Lock and application (highly recommended for highest security). The reasons is, that the 128-bit key in the application is less safe than the 128-bit key in the SG-Lock. When a hacker succeeds to investigate the 128-bit key in the application (which is in principle possible), then he will try that also first for the SG-Lock. That will fail, if a differnt 128-bit key is used in the SG-Lock. For a deeper understanding of the function, please take a look into the SG-Lock include/header file for your programming language. You will find the source code of the function in it.

SGLockMBS.WriteCounter(ProductId as UInt32, CntNum as UInt32, Data as UInt32)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Dongle MBS Dongle Plugin 18.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Writes a 32-bit count value to the SG-Lock memory.

ProductId: Indicates the ProductId of the SG-Lock
CntNum: Number of counter, 0 to 63 - SG-Lock U3 0 to 255 - SG-Lock U4
Data: Counter value to be written

Lasterror property is set.

SGLockMBS.WriteData(ProductId as UInt32, Address as UInt32, Data as MemoryBlock)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Dongle MBS Dongle Plugin 18.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Writes 32-bit data values to SG-Lock memory.

ProductId: Indicates the ProductId of the SG-Lock
Address: Startaddress of data value block 0 to 63 - SG-Lock U3, 0 to 255 - SG-Lock U4
Count: Number of data values
Data: Memoryblock, where data values be copied from. (size is multiply of 4)

Lasterror property is set.

SGLockMBS.WriteKey(ProductId as UInt32, Address as UInt32, Key as MemoryBlock)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Dongle MBS Dongle Plugin 18.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Writes a 128-bit key to the SG-Lock key memory.

ProductId: Indicates the ProductId of the SG-Lock
KeyNum: Number of the key to be written 0 to 1 - SG-Lock U3, 0 to 15 - SG-Lock U4
Key: 128-bit Key to be written. Pointer to data array of 4 integer values of 32-bit, that form the 128-bit key

Lasterror property is set.
The 128-bit key of the U2 is read only and not changeable.

SGLockMBS.WriteProductId(OldProductId as UInt32, NewProductId as UInt32) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Dongle MBS Dongle Plugin 18.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Writes a new 16-bit ProductId to the SG-Lock.

OldProductId: Indicates the actual ProductId of the SG-Lock
NewProductId: Indicates the new ProductId of the SG-Lock

Returns true on success or false on failure.

Lasterror property is set.

The items on this page are in the following plugins: MBS Dongle Plugin.


The biggest plugin in space...