Security-Industry-Association / libosdp-conformance

Apache License 2.0
27 stars 14 forks source link

a fail to secure channel using scbk #32

Closed AKing23T closed 2 weeks ago

AKing23T commented 3 years ago

the content in open-osdp-params.json is as below:

{

"role" : "ACU", "address" : "00", "serial_speed" : "9600", "verbosity" : "9",

"enable-trace" : "1", "enable-secure-channel":"NOT_DEFAULT", "key":"00112233445566778899AABBCCDDEEFF"

}

I run the "050-09-08 Test Security Control Block" in Test-ACU.html to test my PD, but the secure channel failed.

the content in osdp.log is as below: OUTPUT Trace: ff 53 00 08 00 06 60 89 cc

INPUT Trace: ff 53 80 08 00 06 40 3b ca

---OSDP PD Frame:0047 A=00(hex) Timestamp:20201205-160619 (Sec/Nanosec: 1607155579 530067214) SOM ADDR=80 LEN_LSB=08 LEN_MSB=00 CTRL=06 CRC=ca3b Raw input: (L=8./0x0008) 53 80 08 00-06 40 3b ca Pkt: 0047 Message: osdp_ACK A:00 Lth:8. S:02 Check:CRC(ca3b) Command initiate-secure-channel received. DEBUG: enqueue_command: top, cmd->command 3f1 Enqueue: initiate-secure-channel 1 process_command: command is 0 process_command_from_queue: processing command 1009. process_command: command is 1009 Initiating secure channel. Resetting Secure Channel Enabling Secure Channel Current SCBK: (L=16./0x0010) 00 11 22 33-44 55 66 77-88 99 aa bb-cc dd ee ff Current SCBK: (L=16./0x0010) 00 11 22 33-44 55 66 77-88 99 aa bb-cc dd ee ff current_scbk calculating s_enc: 00112233445566778899aabbccddeeff cleartext calculating s_enc: 01823132333435360000000000000000 s_enc in osdp_create_keys: b0ec5e47dccabe03e63b7d45a6e10790 cleartext calculating s_mac1: 01013132333435360000000000000000 s_mac1 in osdp_create_keys: f031d0e399039761d296868e133bf5fb cleartext calculating s_mac2: 01023132333435360000000000000000 s_mac2 in osdp_create_keys: e61f75ef81ef413d6f8f657f04910ffe

---OSDP ACU Frame:0048 DestAddr=00(hex) Timestamp:20201205-160619 (Sec/Nanosec: 1607155579 685342647) SOM ADDR=00 LEN_LSB=13 LEN_MSB=00 CTRL=0f CRC=0e57 [SCB; SCS_11; Key=SCBK] Raw input: (L=19./0x0013) 53 00 13 00-0f 03 11 01-76 31 32 33-34 35 36 37 38 57 0e Pkt: 0048 Message: osdp_CHLNG A:00 Lth:19. S:03 Check:CRC(0e57) Sec block present; CHLNG: RND.A 31323334-35363738 Initiation of secure channel complete (status=0.)

OUTPUT Trace: ff 53 00 13 00 0f 03 11 01 76 31 32 33 34 35 36 37 38 57 0e

INPUT Trace: ff 53 80 2b 00 0f 03 12 00 76 69 7a 01 00 01 00 00 00 a0 a1 a2 a3 a4 a5 a6 a7 74 60 1f f4 b9 20 fe 7c 1f 55 5a b5 7f db 7d 21 8f c1

---OSDP PD Frame:0049 A=00(hex) Timestamp:20201205-160619 (Sec/Nanosec: 1607155579 818547220) decrypted payload: (L=32./0x0020) 69 7a 01 00-01 00 00 00-a0 a1 a2 a3-a4 a5 a6 a7 74 60 1f f4-b9 20 fe 7c-1f 55 5a b5-7f db 7d 21 SOM ADDR=80 LEN_LSB=2b LEN_MSB=00 CTRL=0f CRC=c18f [SCB; SCS_12; Key=SCBK-D(default)] Raw input: (L=43./0x002b) 53 80 2b 00-0f 03 12 00-76 69 7a 01-00 01 00 00 00 a0 a1 a2-a3 a4 a5 a6-a7 74 60 1f-f4 b9 20 fe 7c 1f 55 5a-b5 7f db 7d-21 8f c1 Pkt: 0049 Message: osdp_CCRYPT A:00 Lth:43. S:03 Check:CRC(c18f) Sec block present; Error processing CCRYPT. Secure Channel reset. Resetting Secure Channel Enabling Secure Channel Current SCBK: (L=16./0x0010) 00 11 22 33-44 55 66 77-88 99 aa bb-cc dd ee ff Top of send_message cmd=60:

---OSDP ACU Frame:0050 DestAddr=00(hex) Timestamp:20201205-160619 (Sec/Nanosec: 1607155579 919128935) SOM ADDR=00 LEN_LSB=08 LEN_MSB=00 CTRL=05 CRC=99da Raw input: (L=8./0x0008) 53 00 08 00-05 60 da 99 Pkt: 0050 Message: osdp_POLL A:00 Lth:8. S:01 Check:CRC(99da)

OUTPUT Trace: ff 53 00 08 00 05 60 da 99

INPUT Trace: ff 53 80 08 00 05 40 68 9f

My problem is that whether the way to test scbk is right, if it`s wrong ,how can i do. Please help me, Thank you!

rsgmodelworks commented 2 weeks ago

the "key" value in settings is a leftover artifact. To enable secure channel and set a key do enable-secure-channel=. Saved keys are saved in osdp-saved-parameters.json and reloaded the next time the program starts.

rsgmodelworks commented 2 weeks ago

doc and code updated in 1.50-0