5.1.4.1 Encryption Example

This section provides an example of how the encrypt_secret routine defined in section 5.1.2 encrypts a given cleartext value into a ciphertext using a session key, and given the following parameters:

Parameters

Value

input

50 00 61 00 73 00 73 00 77 00 6f 00 72 00 64 00 31 00 32 00 33 00

sessionkey

4e 98 c9 10 b2 a9 88 d7 92 fb 5a a3 3e 8e f7 86

The following table describes the values keyindex (defined in encrypt_secret) and input, InputKey, OutputKey, and output (defined in des_ecb_lm) after successive calls to des_ecb_lm_enc.

keyindex

input

InputKey

OutputKey

output

0

16 00 00 00 01 00 00 00

4e 98 c9 10 b2 a9 88

4f 4c 32 23 0b 94 a7 10

af 78 44 03

fb a0 92 27

7

50 00 61 00 73 00 73 00

d7 92 fb 5a a3 3e 8e

d6 c8 bf 6b ab 19 fb 1c

8c 95 fc 7e

88 56 4c cd

2

77 00 6f 00 72 00 64 00

c9 10 b2 a9 88 d7 92

c8 89 2c 54 98 46 5e 25

7c d0 c2 41

da 6f 14 41

9

31 00 32 00 33 00 00 00

fb 5a a3 3e 8e f7 86

fb ad a8 67 e9 76 df 0d

56 26 cd a5

81 e9 22 3d

The output variable fields are:

Parameters

Value

output->buffer

af 78 44 03 fb a0 92 27 8c 95 fc 7e 88 56 4c cd 7c d0 c2 41 da 6f 14 41 56 26 cd a5 81 e9 22 3d

output->length

0x20