MagTek MagneSafe V5 User Manual

Page 111

Advertising
background image

Appendix D. Command Examples

103


02 00 ; Reset so changes take effect
Request : CMND=02, LEN=00, DATA=
Response : RC= 00, LEN=00, DATA=

Delay : (waited 5 seconds)
09 00 ; Get current KSN (should be FFFF9876543210E00002)
Request : CMND=09, LEN=00, DATA=
Response : RC= 00, LEN=0A, DATA=FF FF 98 76 54 32 10 E0 00 02

15 00 ; Get current Security Level (Should be 03)
Request : CMND=15, LEN=00, DATA=
Response : RC= 00, LEN=01, DATA=03


Example 7: Changing from Security Level 2 to Security Level 4:

; This script demonstrates changing from Security Level 2 to Security Level 4.
; It assumes the reader is at Security Level 2 with the ANSI X9.24 Example
; key loaded and the KSN counter set to 1.
09 00 ; Get current KSN (should be FFFF9876543210E00001)
Request : CMND=09, LEN=00, DATA=
Response : RC= 00, LEN=0A, DATA=FF FF 98 76 54 32 10 E0 00 01

; For KSN 1, MAC Key: 042666B4918430A3 68DE9628D03984C9
;
; The command to change Security Level looks like: 15 05 04 nnnnnnnn
; where nnnnnnnn is the MAC.
;
; The data to be MACd is: 15 05 04
; Data to be MACd must be in blocks of eight bytes, so we left justify and
; zero fill the block to get: 15 05 04 00 00 00 00 00 (This is the block to MAC)
; For convenience show it as the compacted form: 1505040000000000
;
; The MAC algorithm run with this data uses the following cryptographic
; operations:
;
; Single DES Encrypt the data to be MACd with the left half of the MAC Key:
; 1505040000000000 1DES Enc with 042666B4918430A3 = 644E76C88FFA0044
;
; Single DES Decrypt the result with the right half of the MAC Key:
; 644E76C88FFA0044 1DES Dec with 68DE9628D03984C9 = DEAC363779906C06
;
; Single DES Encrypt the result with the left half of the MAC Key:
; DEAC363779906C06 1DES Enc with 042666B4918430A3 = 2F38A60E3F6AD6AD
;
; The leftmost four bytes of the final result are the MAC = 2F38A60E
;
; Send the MACd Set Security Level command
15 05 04 2F38A60E
Request : CMND=15, LEN=05, DATA=04 2F 38 A6 0E
Response : RC= 00, LEN=00, DATA=

02 00 ; Reset so changes take effect
Request : CMND=02, LEN=00, DATA=
Response : RC= 00, LEN=00, DATA=

Delay : (waited 5 seconds)
09 00 ; Get current KSN (should be FFFF9876543210E00002)
Request : CMND=09, LEN=00, DATA=

Advertising