CN-122001042-A - Lithium battery charging method with bidirectional authentication mechanism and lithium battery system
Abstract
The invention discloses a lithium battery charging method with a bidirectional authentication mechanism, which comprises the steps that a lithium battery sends an authentication request to a charger, the charger generates a first random number according to the authentication request and generates a first authentication code after encryption, the lithium battery decrypts the first authentication code to obtain a second random number, the lithium battery generates a third random number, the second random number and the third random number are encrypted to generate a second authentication code, the charger decrypts the second authentication code to obtain a fourth random number and a fifth random number, the charger encrypts the fifth random number to generate a third authentication code if the fourth random number is identical to the first random number, the lithium battery decrypts the third authentication code to obtain a sixth random number corresponding to the fifth random number, and the lithium battery and the charger finish bidirectional authentication if the sixth random number is identical to the third random number. The invention also discloses a lithium battery system. The invention is used for charging lithium batteries of two-wheelers and tricycles.
Inventors
- LI ZHIJIAN
- Weng Qiuhui
- ZHANG XIANHUI
- Zhang Ruowan
- CHEN CHANGMING
- HU JIAWEI
Assignees
- 广东申睿电气科技有限公司
- 上海申睿电气有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20260204
Claims (10)
- 1. A lithium battery charging method with a bidirectional authentication mechanism is used for charging lithium batteries of two-wheelers and tricycles, and is characterized by comprising the following steps: After the lithium battery is connected with the charger, the lithium battery sends an authentication request to the charger; after receiving the authentication request, the charger generates a first random number according to the authentication request; the charger encrypts a first random number by using a stipulated secret key to generate a first authentication code, and sends the first authentication code to the lithium battery; After the lithium battery receives the first authentication code, decrypting the first authentication code by using the agreed secret key to obtain a second random number; Generating a third random number by the lithium battery, encrypting the second random number and the third random number by using the agreed secret key, generating a second authentication code, and sending the second authentication code to the charger; After receiving the second authentication code, the charger decrypts the second authentication code by using the agreed secret key to obtain a fourth random number corresponding to the second random number and a fifth random number corresponding to the third random number; The charger compares the fourth random number with the first random number, if the fourth random number is the same as the first random number, the fifth random number is encrypted by using the appointed secret key to generate a third authentication code, and the third authentication code is sent to the lithium battery; After the lithium battery receives the third authentication code, decrypting the third authentication code by using the agreed secret key to obtain a sixth random number corresponding to the fifth random number; And comparing the sixth random number with the third random number by the lithium battery, if the sixth random number is the same as the third random number, finishing bidirectional authentication by the lithium battery and the charger, confirming that the charger is matched with the lithium battery, and charging the lithium battery by the charger.
- 2. The method for charging a lithium battery with a two-way authentication mechanism as set forth in claim 1, wherein the agreed key is an AES encryption algorithm.
- 3. The method for charging a lithium battery with a mutual authentication mechanism as set forth in claim 2, wherein the lithium battery and the charger communicate via a CAN bus.
- 4. The method for charging a lithium battery with a mutual authentication mechanism as set forth in claim 1, further comprising updating a provisioning key of the charger by the lithium battery according to a set time interval after the mutual authentication of the lithium battery and the charger is completed, the updating the provisioning key of the charger by the lithium battery comprising: the lithium battery sends a key version negotiation request to the charger; the charger replies key version information according to the key version negotiation request; After the lithium battery receives the key version information, judging whether the key version information is consistent with the key version information of the lithium battery; If the key version information is consistent with the key version information of the lithium battery, the updating is stopped; If the key version information is inconsistent with the key version information of the lithium battery, generating a true random number and sending the true random number to a charger; The charger receives the true random number, generates a pseudo random number, calculates a first HMAC response value according to the current secret key version information of the charger, the true random number and the pseudo random number, and sends the pseudo random number and the first HMAC response value to the lithium battery; The lithium battery verifies the first HMAC response value, if the first HMAC response value is successful, a second HMAC response value is calculated according to the current key version information of the lithium battery, the pseudo random number and the true random number, and the second HMAC response value is sent to a charger; The charger verifies the second HMAC response value, and if the second HMAC response value is successful, a verification success instruction is sent to the lithium battery; After the lithium battery receives the verification success instruction, a temporary transmission key of the session is generated through a key derivation function based on a preset root key, the true random number and the pseudo random number, a new agreement key is produced through an AES encryption algorithm by using the temporary transmission key, a safety frame containing a version number, a time stamp and a serial number is packaged in the new agreement key, and the new agreement key is sent to a charger; the charger decrypts the new appointed secret key and sends confirmation information to the lithium battery; After the lithium battery receives the confirmation information, generating an authentication challenge by using the new agreement secret key and sending the authentication challenge to the charger; The charger responds to the authentication challenge by using the new agreed key; if the response is successful, the charger completes updating the appointed secret key.
- 5. The method for charging a lithium battery with a two-way authentication mechanism as recited in claim 4, wherein the updating the provisioning key of the charger by the lithium battery further comprises storing an old provisioning key for a set time for rollback after the charger completes updating the provisioning key.
- 6. A lithium battery system for use with bicycles and tricycles, comprising a lithium battery and a charger, the lithium battery system further comprising: the lithium battery authentication request module sends an authentication request to the charger after the lithium battery is connected to the charger; the charger random number generation module is used for generating a first random number according to the authentication request after receiving the authentication request; The charger key module is used for encrypting the first random number by using the agreed key to generate a first authentication code and sending the first authentication code to the lithium battery; The lithium battery secret key module decrypts the first authentication code by using the appointed secret key after receiving the first authentication code to obtain a second random number; A lithium battery random number generation module that generates a third random number; the lithium battery secret key module encrypts the second random number and the third random number by using the appointed secret key to generate a second authentication code, and sends the second authentication code to the charger; After receiving the second authentication code, the charger key module decrypts the second authentication code by using the appointed key to obtain a fourth random number corresponding to the second random number and a fifth random number corresponding to the third random number; The charger key module compares the fourth random number with the first random number, if the fourth random number is the same as the first random number, the fifth random number is encrypted by using the appointed key to generate a third authentication code, and the third authentication code is sent to the lithium battery; After the lithium battery secret key module receives the third authentication code, decrypting the third authentication code by using the agreed secret key to obtain a sixth random number corresponding to the fifth random number; The lithium battery secret key module compares the sixth random number with the third random number, and if the sixth random number is the same as the third random number, the lithium battery and the charger finish two-way authentication to confirm that the charger and the lithium battery are matched; And the charging module is used for charging the lithium battery after confirming that the charger is matched with the lithium battery.
- 7. The lithium battery system of claim 6, wherein the agreed key is an AES encryption algorithm.
- 8. The lithium battery system of claim 7, wherein the lithium battery and the charger communicate via a CAN bus.
- 9. The lithium battery system of claim 6, wherein the lithium battery system further comprises a step of updating the agreed key of the charger by the lithium battery according to a set time interval after the two-way authentication of the lithium battery and the charger is completed, and the step of updating the agreed key of the charger by the lithium battery comprises the following steps: the lithium battery sends a key version negotiation request to the charger; the charger replies key version information according to the key version negotiation request; After the lithium battery receives the key version information, judging whether the key version information is consistent with the key version information of the lithium battery; If the key version information is consistent with the key version information of the lithium battery, the updating is stopped; If the key version information is inconsistent with the key version information of the lithium battery, generating a true random number and sending the true random number to a charger; The charger receives the true random number, generates a pseudo random number, calculates a first HMAC response value according to the current secret key version information of the charger, the true random number and the pseudo random number, and sends the pseudo random number and the first HMAC response value to the lithium battery; The lithium battery verifies the first HMAC response value, if the first HMAC response value is successful, a second HMAC response value is calculated according to the current key version information of the lithium battery, the pseudo random number and the true random number, and the second HMAC response value is sent to a charger; The charger verifies the second HMAC response value, and if the second HMAC response value is successful, a verification success instruction is sent to the lithium battery; After the lithium battery receives the verification success instruction, a temporary transmission key of the session is generated through a key derivation function based on a preset root key, the true random number and the pseudo random number, a new agreement key is produced through an AES encryption algorithm by using the temporary transmission key, a safety frame containing a version number, a time stamp and a serial number is packaged in the new agreement key, and the new agreement key is sent to a charger; the charger decrypts the new appointed secret key and sends confirmation information to the lithium battery; After the lithium battery receives the confirmation information, generating an authentication challenge by using the new agreement secret key and sending the authentication challenge to the charger; The charger responds to the authentication challenge by using the new agreed key; if the response is successful, the charger completes updating the appointed secret key.
- 10. The lithium battery system of claim 9, wherein the updating the provisioning key of the charger by the lithium battery further comprises saving the old provisioning key for a set time for rollback after the charger completes updating the provisioning key.
Description
Lithium battery charging method with bidirectional authentication mechanism and lithium battery system Technical Field The invention relates to a lithium battery of a two-wheel vehicle and a three-wheel vehicle, in particular to a lithium battery charging method with a two-way authentication mechanism and a lithium battery system. Background The two-wheel vehicle and the tricycle generally adopt a lithium BATTERY as a power source, along with the increase of the energy density of the lithium BATTERY and the rapid charging rigidity requirement brought by the increase, the high-power lithium BATTERY charger becomes the standard of the lithium BATTERY charging of the two-wheel vehicle and the tricycle, the charging safety problem brought by the high-power lithium BATTERY charger is increasingly prominent, and some chargers which are not authenticated by the original factory of the lithium BATTERY flow into the market, and as the chargers are not matched with the BMS (BATTERY MANAGEMENT SYSTEM ) system of the BATTERY in depth, the charging curve of the lithium BATTERY cannot be followed in the charging process, so that the BATTERY is damaged, a lot of potential safety hazards are caused, and even accidents are caused. The lithium battery charger and the lithium battery of the existing two-wheeled vehicle and three-wheeled vehicle can be used for charging the lithium battery only after authentication based on simple identity information, and the lithium battery can not be completely stopped from being charged by the authentication-free charger. Disclosure of Invention The invention provides a lithium battery charging method and a lithium battery system with a bidirectional authentication mechanism, which are used for solving the technical problems that the lithium battery can be charged only after authentication based on simple identity information and the lithium battery can not be completely stopped from being charged by an authentication-free charger in the prior art. In order to solve the technical problems, the technical scheme adopted by the invention is to design a lithium battery charging method with a bidirectional authentication mechanism, which is used for charging lithium batteries of two-wheelers and tricycles and comprises the following steps: After the lithium battery is connected with the charger, the lithium battery sends an authentication request to the charger; after receiving the authentication request, the charger generates a first random number according to the authentication request; the charger encrypts a first random number by using a stipulated secret key to generate a first authentication code, and sends the first authentication code to the lithium battery; After the lithium battery receives the first authentication code, decrypting the first authentication code by using the agreed secret key to obtain a second random number; Generating a third random number by the lithium battery, encrypting the second random number and the third random number by using the agreed secret key, generating a second authentication code, and sending the second authentication code to the charger; After receiving the second authentication code, the charger decrypts the second authentication code by using the agreed secret key to obtain a fourth random number corresponding to the second random number and a fifth random number corresponding to the third random number; The charger compares the fourth random number with the first random number, if the fourth random number is the same as the first random number, the fifth random number is encrypted by using the appointed secret key to generate a third authentication code, and the third authentication code is sent to the lithium battery; After the lithium battery receives the third authentication code, decrypting the third authentication code by using the agreed secret key to obtain a sixth random number corresponding to the fifth random number; And comparing the sixth random number with the third random number by the lithium battery, if the sixth random number is the same as the third random number, finishing bidirectional authentication by the lithium battery and the charger, confirming that the charger is matched with the lithium battery, and charging the lithium battery by the charger. The agreed key is an AES encryption algorithm. The lithium battery is communicated with the charger through a CAN bus. The lithium battery charging method with the bidirectional authentication mechanism further comprises the step that after the bidirectional authentication is completed between the lithium battery and the charger, the lithium battery updates the agreed secret key of the charger according to a set time interval, and the step that the lithium battery updates the agreed secret key of the charger comprises the following steps: the lithium battery sends a key version negotiation request to the charger; the charger replies key version information according to the key ve