User's Manual

47
Abort();
All accesses to the KeyPresent variable must be executed on different levels of the function calls.
10.1.7 Encrypt the required data with the Scrambling operation
Some values required for correct execution of your operation can be encrypted with the Scrambling operation. The
Scrambling operation is only a one-way function. Nevertheless, it can be used for encrypting data by using the XOR
operator. You just have to select an initialization value, saved in your program, as an input of Scrambling. You can
encrypt and decrypt your data with an XOR with a Scrambling output.
Example
With these pre-calculation steps:
DATA0 = “FIRSTDATA”
DATA1 = “OTHERDATA”
SEED = “01234567”
MASK = Scramble(SEED)
CYPHER0 = MASK XOR DATA0
MASK = Scramble(MASK)
CYPHER1 = MASK XOR DATA1
you can do the following in your source:
CYPHER0 = “????????” (previously computed)
CYPHER1 = “????????” (previously computed)
SEED = “01234567”
MASK = Scramble(SEED)
DATA0 = MASK XOR CIPHER0
MASK = Scramble(MASK)
DATA1 = MASK XOR CIPHER1
10.2 Guidelines for the Memory
The following guidelines apply to all SmartKey models with a memory.
10.2.1 Control the Memory's functionality
A step against possible use of the Hardware and Kernel Driver emulators is to test the functionality of SmartKey's
memory. Just write a random value in the memory cell and read it. If the values differ, you are faced with a SmartKey
emulator.
This trick works because emulators operate at a very low level and generally ignore the semantics of the operation, but
are able to record the communication only.
Moreover, the User Level emulators that intercept the SmartKey API calls can easily simulate the memory's
functionality. Only the Scrambling operation, as previously described, is viable for use against these emulators.
10.2.2 Store the data required by the Memory
A typical approach entails saving some known values on SmartKey and controlling them to check the presence of
SmartKey. This approach is an easy prey for attacks, because a correct copy of these values must be stored in your
program, and it is relatively simple to remove these controls.
On the contrary, some values needed for executing your program correctly can be stored in SmartKey's memory. You
can indirectly verify their validity, by using them and expecting some errors. You do not have to compare them to a
correct copy.
Example
There are usually various constant values in a Windows program. There are no limits to choosing these values. One can
use anything that can easily be converted into bytes.
Some typical examples:
All numeric constants.
All the contents of your tables.
Any Windows constant/variable: dialog IDs, string IDs, message codes, and constant functions subjects