This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I have below questions regarding SHA-1/HMAC authentication
a) The default plain text authentication key is 0x0123456789ABCDEFFEDCBA987654321 which is actually 15bytes and 4 bits, can you tell me should we use 0x00123456789ABCDEFFEDCBA987654321 or 0x0123456789ABCDEFFEDCBA9876543210
b) When I am authenticating the battery I need to send AuthenticateChecksum() after AuthenticateData(), can you please tell what method is used to generate the checksum.
c) Can you recommend any tool to generate 20 byte authentication challenge and as well as checksum? it will be a great help.
d) And finally in the data sheet it says “The resulting digest is written to AuthenticateData(), overwriting the pre-existing challenge”. What is this digest same as the challenge message sent by host?
I am referring to the sections 8.3.15.1, 8.3.15.2, 8.3.15.3 in bq34z100-g1 datasheet.
Here are some comments.
a) use 0x0123456789ABCDEFFEDCBA9876543210
b) The checksum is (FF-x) where x is the 8-bit summation of the BlockData() (0x40 to 0x5F) on a byte-by-byte basis.
c) This tool is available in bqStudio for the bq40z50-R1 device. You can open bqStudio without an module connected and select the bq40z50-R1. The tool is under the Authentication tab.
d) This means that the device replaces the Challenge that was entered by the HOST with the Digest that it calculated. The HOST can read this to verify that it is a match to the Digest that it expects.
Hi Thomas,
Thanks for your email.
I was testing the authentication with demo board BQ34Z100EVM. The below is what I observed when I test the authentication command
On power ON if I read 20 bytes from the address 0x40, the response is 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Then I write 20 byte of data “43703e5ecd36cbabee0974beb7069db164635d17” to the location 0x40. And if I read the data immediately I receive “43 70 3E 5E CD 36 CB AB EE 09 74 BE B7 06 9D B1 64 63 5D 17”
But as per datasheet the command sequence should be “If in SEALED mode, 0x00 must be written to DataFlashBlock().Next, the host writes a 20-byte authentication challenge to the AuthenticateData() address locations (0x40 through 0x53). After a valid checksum for the challenge is written to AuthenticateChecksum(),”
Though I don’t send all the necessary commands I will receive the 20 byte correct digest. Can you please tell me if I am doing something wrong.
Please find the attached log
Advanced Comm Transaction Log TimeStamp , Read/Write , Address , Register , Length , Data , 2016-03-18 04:20:53 813 , Rd , aa , 40 , 20 , 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2016-03-18 04:22:15 828 , Wr , aa , 40 , 20 , 43 70 3e 5e cd 36 cb ab ee 09 74 be b7 06 9d b1 64 63 5d 17 2016-03-18 04:22:17 793 , Rd , aa , 40 , 20 , 43 70 3E 5E CD 36 CB AB EE 09 74 BE B7 06 9D B1 64 63 5D 17
Thanks
Hi Thomas,
Thanks for the reply. I could get the same log,
Here my question is, how should I use the digest reply to validate the authentication.
Now the reply "14 AB AC 77 ..." is not matching with either key or the 20 byte challenge. Please clarify if I need to de-crypt the response.
Thanks,
-Umasankar K
The device calculates the digest based on the key that is stored on the device and the challenge that is sent from the host. The host then compares the digest to the digest that it expects to receive. If they are the same, then the key must have been correct and the host accepts the battery pack. If they are different, then the host rejects the battery pack.
Here are the data I have used to authenticate :
a) Plain text key is 0123456789ABCDEFFEDCBA9876512340
b) HMAC_SHA1 result is 065196648d48b526fbc60df68481008d80f8501e, this key is generated using online tool myeasywww.appspot.com/.../en
i didnt use any Secret Passphrase to generate the challenge.
c) Checksum is C2
Device is in UNSEALED MODE , below is the log
Rd/Wr Address Register Length Data
-------------------------------------------------------------
Wr aa 61 1 01
Wr aa 3e 1 70
Wr aa 3f 1 00
Wr aa 40 20 06 51 96 64 8d 48 b5 26 fb c6 0d f6 84 81 00 8d 80 f8 50 1e
Wr aa 54 1 C2
Rd aa 40 32 D1 D6 F7 1D 22 5B 30 CA E4 7D FC 5B 46 92 70 2F 07 A3 27 8A 00 00 00 00 00 00 00 00 00 00 00 00
Here the digest I have received is "D1 D6 F7 1D 22 5B 30 CA E4 7D FC 5B 46 92 70 2F 07 A3 27 8A ", Now can you please tell how this 20 byte digest data is generated by BQ chup to cross verify at the host end.
Please tell whether I have wrongly generated a challenge or wrong key I have used.
And as you suggested I am using bqstudio 1.3.45, can you tell me how can I use this tool to generate correct HMAC_SHA1.
I may be using wrong tool or wrong way of generating HMAC_SHA1 challenge.
Thanks in advance for your great help.
I tried the tool that you used and did not receive the same digest that our tool calculated. I added the authentication page to the attached .bqz file, so that you can use our tool. I will have to do some ore research to find out why they do not get the same answer, but I do not know that I will get to it this week.