Charging fee settlement method and system for vehicle-mounted charger
Through two-way authentication and dynamic key encryption technology, combined with SSL protocol and blockchain evidence storage, the security issues in the settlement of charging fees of on-board chargers are solved, and data security and user experience are improved.
Patent Information
- Application Number
- CN202510553570.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-09-16
AI Technical Summary
Traditional on-board charger charging fee settlement methods have the risk of key leakage and lack end-to-end two-way authentication and integrity verification, leading to user privacy data leakage and fraud, affecting the safety of the operator and causing economic losses.
It adopts two-way authentication, dynamic key encryption and blockchain evidence storage technology, through QR code authentication, SSL protocol encrypted data transmission, multi-layer encryption algorithm and timestamp verification, to ensure the security and integrity of charging data, and store the encrypted log on the chain.
It effectively prevents data theft and tampering, improves the security of charging fee settlement of on-board chargers, simplifies user operations, optimizes charging service processes and user experience, and reduces the risk of settlement errors.
Smart Images

Figure CN120655366A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of vehicle-mounted chargers, and in particular to a method and system for settling charging fees for a vehicle-mounted charger. Background Art
[0002] In ride-hailing scenarios, due to vehicle configuration limitations (e.g., insufficient rear-seat charging ports) and user behavior (low rates of charging equipment carried on short trips), standardized power supply facilities are urgently needed to enhance the service experience. Consequently, shared onboard chargers have emerged. As onboard power conversion devices, their core function is to capture power from the vehicle's cigarette lighter port to charge mobile devices (including but not limited to smartphones and tablets), alleviating passengers' anxiety about battery life.
[0003] Before using a shared on-board charger, users complete identity authentication and device binding by scanning the charger's unique QR code. Real-time data generated during the charging process (including device identification code, charging start / end time, current and voltage parameters, etc.) is locally encrypted and uploaded to the billing server. The billing server calculates the charging fee based on the charging duration or power consumed, and completes the fee settlement through a real-time deduction mechanism based on the account balance. However, traditional charging fee settlement methods have the following technical flaws: 1. At the encryption algorithm level, it uses AES-128 symmetric encryption with a fixed key, lacks a dynamic key update mechanism, and poses a risk of key leakage; 2. It lacks an end-to-end two-way authentication channel, making it vulnerable to man-in-the-middle attacks that can lead to the theft or tampering of relevant data; 3. The lack of integrity verification allows attackers to forge charging termination instructions or modify power metering parameters to illegally circumvent fee settlement.
[0004] The above-mentioned technical defects cause the operating entities to face double risks: first, user privacy data (including device identification codes, user identity identifiers, etc.) may be illegally intercepted; second, malicious users can crack the communication protocol through reverse engineering and carry out fraudulent activities such as zero-yuan recharge and repeated recharge, causing direct economic losses.
[0005] Therefore, how to provide a method and system for settling charging fees for an on-board charger to improve the security of charging fee settlement for the on-board charger has become a technical problem that needs to be solved urgently. Summary of the Invention
[0006] The technical problem to be solved by the present invention is to provide a method and system for settling charging fees of an on-board charger, so as to improve the security of charging fee settlement of the on-board charger.
[0007] In a first aspect, the present invention provides a method for settling charging fees for a vehicle-mounted charger, comprising the following steps:
[0008] Step S10: The mobile terminal accesses the server through the QR code on the on-board charger, performs a login operation after performing two-way authentication with the server, and starts the power output of the on-board charger;
[0009] Step S20: During the power output process of the vehicle charger, the charging plaintext data including at least the charging time, charging voltage, charging current, charging temperature, SOC, and positioning data are recorded in real time;
[0010] Step S30: The onboard charger encrypts the charging plaintext data in the upload period into charging ciphertext data based on a preset upload period, and uploads the charging ciphertext data to the server via the SSL protocol;
[0011] Step S40: The server stores the received charging ciphertext data, decrypts and verifies the charging ciphertext data to obtain charging plaintext data, generates a charging progress report based on the charging plaintext data, and displays the charging progress report through a preset webpage;
[0012] Step S50: When the vehicle charger finishes charging, it sends a charging completion notification to the server via the SSL protocol;
[0013] Step S60: After verifying the received charging end notification, the server calculates the charging fee based on each of the charging plaintext data, and generates a charging bill based on the charging fee;
[0014] Step S70: The server encrypts the charging bill into an encrypted bill, and pushes the encrypted bill to the mobile terminal via the SSL protocol for settlement;
[0015] Step S80: The server generates a charging log based on the plaintext charging data and the charging bill, encrypts the charging log into an encrypted log, calculates the data fingerprint of the encrypted log, stores the encrypted log, and uploads the data fingerprint to the blockchain.
[0016] Furthermore, the step S10 specifically includes:
[0017] Step S11: The CA platform creates a private key, a root certificate carrying a root public key, a first mobile private key, a first mobile public key, a first service private key, and a first service public key. The first mobile public key is signed with the root private key to obtain a mobile certificate. The first service public key is signed with the root private key to obtain a service certificate.
[0018] Step S12: The mobile terminal scans the QR code on the vehicle charger to obtain the URL of the server and the device serial number of the vehicle charger, obtains the root certificate, mobile certificate, and first mobile private key from the CA platform, generates a first random number, obtains the current first timestamp, generates a first authentication instruction based on the mobile certificate, the first random number, and the first timestamp, and sends the first authentication instruction to the server via the URL;
[0019] Step S13: The server obtains the root certificate, service certificate, and first service private key from the CA platform, parses the received first authentication instruction to obtain the mobile certificate, the first random number, and the first timestamp, performs a validity check using the first timestamp, extracts the root public key from the root certificate, verifies the signature of the mobile work certificate using the root public key, and then extracts the first mobile public key from the mobile work certificate.
[0020] The server generates a second random number, a second service private key, and a second service public key, signs the first random number and the second service public key using the first service private key to obtain first signature data, generates a second authentication instruction carrying the first signature data, the second service public key, the service certificate, the second random number, and a second timestamp, and sends the second authentication instruction to the mobile terminal;
[0021] Step S14: The mobile terminal parses the second authentication instruction to obtain the first signature data, the second service public key, the service certificate, the second random number, and the second timestamp. After performing a time validity check using the second timestamp, the mobile terminal extracts the root public key from the root certificate, verifies the service certificate using the root public key, and then extracts the first service public key from the service certificate.
[0022] The mobile terminal generates a second mobile private key and a second mobile public key, negotiates a first session key with the second mobile private key and the second service public key, calculates a first check value for the first session key, signs the second random number, the second mobile public key, and the first check value using the first mobile private key to obtain second signature data, generates a third authentication instruction carrying the second signature data, the second mobile public key, the first check value, and a third timestamp, and sends the third authentication instruction to the server;
[0023] Step S15: After verifying the received third authentication instruction, the server negotiates a second session key using the second mobile public key and the second service private key carried in the third authentication instruction, calculates a second check value for the second session key, generates a fourth authentication instruction carrying the second check value and a fourth timestamp, and sends it to the mobile terminal. After the mobile terminal verifies the received fourth authentication instruction, bidirectional authentication is completed, and a secure communication channel is established between the mobile terminal and the server.
[0024] Step S16: The mobile terminal encrypts the account, password, and device serial number into login ciphertext data using the second mobile private key and sends it to the server. The server decrypts the login ciphertext data using the second mobile public key to obtain the account, password, and device serial number. After matching and verifying the account and password, the login operation of the mobile terminal is completed, and the power output of the vehicle charger is started based on the device serial number.
[0025] Furthermore, the step S30 is specifically as follows:
[0026] The on-board charger presets a charging key created based on the AES256 algorithm, reads the charging plaintext data within the upload period based on a preset upload period, obtains the current fifth timestamp, performs hash calculation on the charging plaintext data and the fifth timestamp to obtain a first hash value, intercepts a character string of a preset length from the fifth timestamp according to a preset interception rule to obtain a first time parameter, concatenates the charging key and the first time parameter to obtain a first dynamic key, encrypts the charging data using the first dynamic key to obtain primary encrypted data, encrypts the primary encrypted data, the charging key, the fifth timestamp and the first hash value using the RC6 algorithm to obtain secondary encrypted data, swaps the first 3 characters with the last 3 characters of the secondary encrypted data to obtain charging ciphertext data, and uploads the charging ciphertext data to the server in real time via the SSL protocol.
[0027] Furthermore, the step S40 is specifically as follows:
[0028] The server receives the charging ciphertext data, stores the charging ciphertext data in a designated path, swaps the first three characters with the last three characters of the charging ciphertext data to obtain level-two encrypted data, decrypts the level-two encrypted data using the RC6 algorithm to obtain level-one encrypted data, a charging key, a fifth timestamp, and a first hash value, intercepts a character string of a preset length from the fifth timestamp using a preset interception rule to obtain a first time parameter, concatenates the charging key and the first time parameter to obtain a first dynamic key, decrypts the level-one encrypted data using the first dynamic key to obtain charging plaintext data, performs an integrity check on the charging data and the fifth timestamp using the first hash value, and then performs an age check on the fifth timestamp;
[0029] Then, the charging plaintext data is parsed to obtain the charging time, charging voltage, charging current, charging temperature, SOC and positioning data. Based on the charging time, charging voltage, charging current and SOC, a charging progress report is generated that at least includes the charging time, the charged power and the estimated remaining time to fully charge. The charging progress report is displayed through a preset web page.
[0030] Furthermore, the step S50 is specifically as follows:
[0031] When the vehicle charger ends charging, it generates a charging end notification carrying an encrypted message, a sixth timestamp, and a second hash value, and sends the charging end notification to the server in real time through the SSL protocol;
[0032] The encrypted message is obtained by encrypting the device serial number and the vehicle VIN code. The specific encryption process is: hashing the device serial number, the vehicle VIN code and the sixth timestamp to obtain a second hash value, intercepting a character string of a preset length from the sixth timestamp according to a preset interception rule to obtain a second time parameter, concatenating a preset charging key with the second time parameter to obtain a second dynamic key, encrypting the device serial number and the vehicle VIN code using the second dynamic key to obtain a layer of encrypted data, encrypting the first layer of encrypted data and the charging key into a second layer of encrypted data using the IDEA algorithm, and swapping the first 4 characters and the last 4 characters of the second layer of encrypted data to obtain an encrypted message; the second hash value is obtained by hashing the encrypted message and the sixth timestamp.
[0033] In a second aspect, the present invention provides a vehicle-mounted charger charging fee settlement system, comprising the following modules:
[0034] A two-way authentication module is used for the mobile terminal to access the server through the QR code set on the car charger, perform the login operation after two-way authentication with the server, and start the power output of the car charger;
[0035] The charging plaintext data recording module is used to record the charging plaintext data including at least charging time, charging voltage, charging current, charging temperature, SOC and positioning data in real time during the power output of the vehicle charger;
[0036] The charging ciphertext data uploading module is used for the on-board charger to encrypt the charging plaintext data within the upload period into charging ciphertext data based on a preset upload period, and upload the charging ciphertext data to the server via the SSL protocol;
[0037] a charging progress report generating module, configured to store the received charging ciphertext data on the server, decrypt and verify the charging ciphertext data to obtain charging plaintext data, generate a charging progress report based on the charging plaintext data, and display the charging progress report through a preset webpage;
[0038] The charging end notification sending module is used for the on-board charger to send a charging end notification to the server via the SSL protocol when charging is completed;
[0039] A charging bill generation module, configured to calculate the charging fee based on each of the charging plaintext data after the server verifies the received charging end notification, and generate a charging bill based on the charging fee;
[0040] The charging fee settlement module is used for the server to encrypt the charging bill into an encrypted bill and push the encrypted bill to the mobile terminal through the SSL protocol for settlement;
[0041] The charging log management module is used for the server to generate a charging log based on the charging plaintext data and the charging bill, encrypt the charging log into an encrypted log, calculate the data fingerprint of the encrypted log, store the encrypted log and upload the data fingerprint to the blockchain.
[0042] Furthermore, the two-way authentication module specifically includes:
[0043] A certificate initialization unit is configured to create a private key, a root certificate carrying a root public key, a first mobile private key, a first mobile public key, a first service private key, and a first service public key on the CA platform; the first mobile public key is signed with the root private key to obtain a mobile certificate; and the first service public key is signed with the root private key to obtain a service certificate;
[0044] a first authentication instruction sending unit, configured to scan a QR code provided on the vehicle charger with a mobile terminal to obtain a URL of a server and a device serial number of the vehicle charger, obtain the root certificate, mobile certificate, and first mobile private key from the CA platform, generate a first random number, obtain a current first timestamp, generate a first authentication instruction based on the mobile certificate, the first random number, and the first timestamp, and send the first authentication instruction to the server via a URL;
[0045] a second authentication instruction sending unit, configured to obtain, on the server, the root certificate, the service certificate, and the first service private key from the CA platform, parse the received first authentication instruction to obtain a mobile certificate, a first random number, and a first timestamp, perform an aging check using the first timestamp, extract a root public key from the root certificate, verify the signature of the mobile work certificate using the root public key, and then extract the first mobile public key from the mobile work certificate;
[0046] The server generates a second random number, a second service private key, and a second service public key, signs the first random number and the second service public key using the first service private key to obtain first signature data, generates a second authentication instruction carrying the first signature data, the second service public key, the service certificate, the second random number, and a second timestamp, and sends the second authentication instruction to the mobile terminal;
[0047] a third authentication instruction sending unit, configured for the mobile terminal to parse the second authentication instruction to obtain the first signature data, the second service public key, the service certificate, the second random number, and the second timestamp; after performing a time validity check using the second timestamp, extract the root public key from the root certificate; verify the signature of the service certificate using the root public key; and then extract the first service public key from the service certificate;
[0048] The mobile terminal generates a second mobile private key and a second mobile public key, negotiates a first session key with the second mobile private key and the second service public key, calculates a first check value for the first session key, signs the second random number, the second mobile public key, and the first check value using the first mobile private key to obtain second signature data, generates a third authentication instruction carrying the second signature data, the second mobile public key, the first check value, and a third timestamp, and sends the third authentication instruction to the server;
[0049] a fourth authentication instruction sending unit, configured to, after the server verifies the received third authentication instruction, negotiate a second session key using the second mobile public key and the second service private key carried in the third authentication instruction, calculate a second check value for the second session key, generate a fourth authentication instruction carrying the second check value and a fourth timestamp, and send it to the mobile terminal; after the mobile terminal verifies the received fourth authentication instruction, complete two-way authentication and establish a secure communication channel between the mobile terminal and the server;
[0050] The account and password verification unit is used for the mobile terminal to encrypt the account, password and device serial number into login ciphertext data using the second mobile private key and send it to the server. The server decrypts the login ciphertext data using the second mobile public key to obtain the account, password and device serial number. After matching and verifying the account and password, the login operation of the mobile terminal is completed and the power output of the vehicle charger is started based on the device serial number.
[0051] Furthermore, the charging ciphertext data uploading module is specifically used to:
[0052] The on-board charger presets a charging key created based on the AES256 algorithm, reads the charging plaintext data within the upload period based on a preset upload period, obtains the current fifth timestamp, performs hash calculation on the charging plaintext data and the fifth timestamp to obtain a first hash value, intercepts a character string of a preset length from the fifth timestamp according to a preset interception rule to obtain a first time parameter, concatenates the charging key and the first time parameter to obtain a first dynamic key, encrypts the charging data using the first dynamic key to obtain primary encrypted data, encrypts the primary encrypted data, the charging key, the fifth timestamp and the first hash value using the RC6 algorithm to obtain secondary encrypted data, swaps the first 3 characters with the last 3 characters of the secondary encrypted data to obtain charging ciphertext data, and uploads the charging ciphertext data to the server in real time via the SSL protocol.
[0053] Furthermore, the charging progress report generation module is specifically used to:
[0054] The server receives the charging ciphertext data, stores the charging ciphertext data in a designated path, swaps the first three characters with the last three characters of the charging ciphertext data to obtain level-two encrypted data, decrypts the level-two encrypted data using the RC6 algorithm to obtain level-one encrypted data, a charging key, a fifth timestamp, and a first hash value, intercepts a character string of a preset length from the fifth timestamp using a preset interception rule to obtain a first time parameter, concatenates the charging key and the first time parameter to obtain a first dynamic key, decrypts the level-one encrypted data using the first dynamic key to obtain charging plaintext data, performs an integrity check on the charging data and the fifth timestamp using the first hash value, and then performs an age check on the fifth timestamp;
[0055] Then, the charging plaintext data is parsed to obtain the charging time, charging voltage, charging current, charging temperature, SOC and positioning data. Based on the charging time, charging voltage, charging current and SOC, a charging progress report is generated that at least includes the charging time, the charged power and the estimated remaining time to fully charge. The charging progress report is displayed through a preset web page.
[0056] Furthermore, the charging end notification sending module is specifically used to:
[0057] When the vehicle charger ends charging, it generates a charging end notification carrying an encrypted message, a sixth timestamp, and a second hash value, and sends the charging end notification to the server in real time through the SSL protocol;
[0058] The encrypted message is obtained by encrypting the device serial number and the vehicle VIN code. The specific encryption process is: hashing the device serial number, the vehicle VIN code and the sixth timestamp to obtain a second hash value, intercepting a character string of a preset length from the sixth timestamp according to a preset interception rule to obtain a second time parameter, concatenating a preset charging key with the second time parameter to obtain a second dynamic key, encrypting the device serial number and the vehicle VIN code using the second dynamic key to obtain a layer of encrypted data, encrypting the first layer of encrypted data and the charging key into a second layer of encrypted data using the IDEA algorithm, and swapping the first 4 characters and the last 4 characters of the second layer of encrypted data to obtain an encrypted message; the second hash value is obtained by hashing the encrypted message and the sixth timestamp.
[0059] The advantages of the present invention are:
[0060] 1. Use the QR code on the car charger to access the server through a mobile terminal, perform a two-way authentication with the server, and log in to start the power output of the car charger. During the power output process of the car charger, the charging plaintext data is recorded in real time, and the charging plaintext data within the upload cycle is encrypted into charging ciphertext data and uploaded to the server. The server decrypts and verifies the charging ciphertext data to obtain the charging plaintext data, and generates a charging progress report based on the charging plaintext data and displays it on a preset web page. When charging is finished, the car charger sends a charging end notification to the server. After verifying the charging end notification, the server calculates the charging cost based on each charging plaintext data, generates a charging bill based on the charging cost, and encrypts the charging bill into an encrypted bill. Push to the mobile terminal for settlement; and the server generates a charging log based on the plaintext data of each charging and the charging bill, encrypts the charging log into an encrypted log, calculates the data fingerprint of the encrypted log, stores the encrypted log and uploads the data fingerprint to the blockchain; that is, before using the on-board charger for charging, the mobile terminal first performs two-way authentication with the server, and charging is started only after the authentication is passed. In addition, throughout the life cycle of the on-board charger, the uploading of the charging plaintext data, the sending of the charging end notification, the sending of the charging bill and the storage of the charging log all adopt multiple encryption combined with dynamic keys, and combined with integrity verification, which can effectively prevent the relevant data from being stolen and tampered with in plain text, and ultimately greatly improve the security of the charging fee settlement of the on-board charger.
[0061] 2. Through the multi-level CA authentication system of root certificate, mobile certificate and service certificate, combined with random numbers, timestamps and dynamic key negotiation (such as the first / second session key), the bidirectional identity legitimacy of the mobile terminal and the server is ensured, effectively resisting the risks of man-in-the-middle attacks and counterfeit terminals, thereby effectively improving the security of charging fee settlement for on-board chargers.
[0062] 3. By using timestamp interception to generate dynamic keys (such as splicing the first time parameter with the charging key), combined with multi-layer encryption algorithms such as AES256, RC6, and IDEA, the encryption strength is significantly improved. In addition, character swapping (such as swapping the first 3 characters with the last 3 characters) increases the complexity of the ciphertext, effectively preventing replay attacks and key cracking, thereby effectively improving the security of charging fee settlement for on-board chargers.
[0063] 4. Through hash calculation and timestamp verification, it is ensured that the data has not been tampered with during transmission and storage, and is timely, to prevent expired data from being maliciously used, thereby effectively improving the security of charging fee settlement for on-board chargers.
[0064] 5. By uploading the data fingerprint of the encrypted log to the chain and utilizing the tamper-proof nature of the blockchain, the charging process can be permanently traced, enhancing the credibility of dispute resolution.
[0065] 6. By uploading charging ciphertext data in batches according to the preset upload cycle, the network burden caused by real-time transmission is avoided. At the same time, the transmission efficiency is optimized through the SSL protocol to balance real-time performance and resource consumption.
[0066] 7. Dynamic keys are generated based on time parameters, eliminating the need to frequently update preset keys, reducing the complexity of key management and improving encryption and decryption efficiency.
[0067] 8. Generate a visual charging progress report based on the charging plaintext data, and display the charging time, charged power, estimated remaining time to full charge and other information in real time on the web page to optimize the user interaction experience.
[0068] 9. By setting the charging plaintext data to cover charging time, charging voltage, charging current, charging temperature, SOC and positioning data, the charging status can be fully monitored. Combining temperature and SOC data can warn of abnormal conditions (such as overheating or overcharging) and improve charging safety.
[0069] 10. By automating the entire process from charging initiation to charging bill generation, and pushing encrypted bills to mobile terminals, manual intervention is reduced and the risk of settlement errors is lowered.
[0070] 11. By setting up the mobile terminal to directly access the server through the QR code of the car charger, the user operation process is simplified and the usability of the device is improved.
[0071] 12. Through core technological innovations such as two-way authentication, dynamic encryption, and blockchain evidence storage, a safe, efficient, and reliable on-board charger charging fee settlement system has been built, which optimizes the charging service process and user experience while ensuring data security and user privacy. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0073] Figure 1 The present invention is a flow chart of a method for settling charging fees of a vehicle-mounted charger.
[0074] Figure 2 The present invention is a structural diagram of a vehicle-mounted charger charging fee settlement system. DETAILED DESCRIPTION
[0075] The technical solution in the embodiment of the present application has the following overall idea: before using the on-board charger for charging, the mobile terminal first performs two-way authentication with the server, and charging is started only after the authentication is passed. In addition, during the entire life cycle of using the on-board charger, the uploading of charging plaintext data, the sending of charging end notifications, the sending of charging bills, and the storage of charging logs all adopt multiple encryption combined with dynamic keys and combined with integrity verification, which can effectively prevent the relevant data from being stolen and tampered with in plain text, thereby improving the security of charging fee settlement of the on-board charger.
[0076] Please refer to Figures 1 to 2 As shown, a preferred embodiment of a method for settling charging fees for a vehicle-mounted charger of the present invention includes the following steps:
[0077] Step S10: The mobile terminal accesses the server through the QR code on the on-board charger, performs a login operation after performing two-way authentication with the server, and starts the power output of the on-board charger;
[0078] By setting up the mobile terminal to directly access the server through the QR code of the car charger, the user operation process is simplified and the usability of the device is improved.
[0079] Step S20: During the power output process of the vehicle charger, the charging plaintext data including at least the charging time, charging voltage, charging current, charging temperature, SOC, and positioning data are recorded in real time;
[0080] By setting the charging plaintext data to cover charging time, charging voltage, charging current, charging temperature, SOC and positioning data, the charging status can be fully monitored. Combining temperature and SOC data can warn of abnormal conditions (such as overheating or overcharging) and improve charging safety.
[0081] Step S30: The onboard charger encrypts the charging plaintext data in the upload period into charging ciphertext data based on a preset upload period, and uploads the charging ciphertext data to the server via the SSL protocol;
[0082] By uploading charging ciphertext data in batches according to the preset upload cycle, the network burden caused by real-time transmission is avoided. At the same time, the transmission efficiency is optimized through the SSL protocol, balancing real-time performance and resource consumption.
[0083] Step S40: The server stores the received charging ciphertext data, decrypts and verifies the charging ciphertext data to obtain charging plaintext data, generates a charging progress report based on the charging plaintext data, and displays the charging progress report through a preset webpage;
[0084] Step S50: When the vehicle charger finishes charging, it sends a charging completion notification to the server via the SSL protocol;
[0085] Step S60: After verifying the received charging end notification, the server calculates the charging fee based on each of the charging plaintext data, and generates a charging bill based on the charging fee;
[0086] Step S70: The server encrypts the charging bill into an encrypted bill, and pushes the encrypted bill to the mobile terminal via the SSL protocol for settlement;
[0087] Step S80: The server generates a charging log based on the plaintext charging data and the charging bill, encrypts the charging log into an encrypted log, calculates the data fingerprint of the encrypted log, stores the encrypted log, and uploads the data fingerprint to the blockchain.
[0088] By automating the entire process from charging initiation to charging bill generation, encrypted bills are pushed to mobile terminals, reducing manual intervention and the risk of settlement errors.
[0089] Through core technology innovations such as two-way authentication, dynamic encryption, and blockchain evidence storage, a safe, efficient, and reliable on-board charger charging fee settlement system has been built, which optimizes the charging service process and user experience while ensuring data security and user privacy.
[0090] The step S10 specifically includes:
[0091] Step S11: The CA platform creates a private key, a root certificate carrying a root public key, a first mobile private key, a first mobile public key, a first service private key, and a first service public key. The first mobile public key is signed with the root private key to obtain a mobile certificate. The first service public key is signed with the root private key to obtain a service certificate.
[0092] Step S12: The mobile terminal scans the QR code on the vehicle charger to obtain the URL of the server and the device serial number of the vehicle charger, obtains the root certificate, mobile certificate, and first mobile private key from the CA platform, generates a first random number, obtains the current first timestamp, generates a first authentication instruction based on the mobile certificate, the first random number, and the first timestamp, and sends the first authentication instruction to the server via the URL;
[0093] Step S13: The server obtains the root certificate, service certificate, and first service private key from the CA platform, parses the received first authentication instruction to obtain the mobile certificate, the first random number, and the first timestamp, performs a validity check using the first timestamp, extracts the root public key from the root certificate, verifies the signature of the mobile work certificate using the root public key, and then extracts the first mobile public key from the mobile work certificate.
[0094] The server generates a second random number, a second service private key, and a second service public key, signs the first random number and the second service public key using the first service private key to obtain first signature data, generates a second authentication instruction carrying the first signature data, the second service public key, the service certificate, the second random number, and a second timestamp, and sends the second authentication instruction to the mobile terminal;
[0095] Step S14: The mobile terminal parses the second authentication instruction to obtain the first signature data, the second service public key, the service certificate, the second random number, and the second timestamp. After performing a time validity check using the second timestamp, the mobile terminal extracts the root public key from the root certificate, verifies the service certificate using the root public key, and then extracts the first service public key from the service certificate.
[0096] The mobile terminal generates a second mobile private key and a second mobile public key, negotiates a first session key with the second mobile private key and the second service public key, calculates a first check value for the first session key, signs the second random number, the second mobile public key, and the first check value using the first mobile private key to obtain second signature data, generates a third authentication instruction carrying the second signature data, the second mobile public key, the first check value, and a third timestamp, and sends the third authentication instruction to the server;
[0097] Step S15: After verifying the received third authentication instruction, the server negotiates a second session key using the second mobile public key and the second service private key carried in the third authentication instruction, calculates a second check value for the second session key, generates a fourth authentication instruction carrying the second check value and a fourth timestamp, and sends it to the mobile terminal. After the mobile terminal verifies the received fourth authentication instruction, bidirectional authentication is completed, and a secure communication channel is established between the mobile terminal and the server; the first check value and the second check value are both MD5 values.
[0098] The server verifies the received third authentication instruction specifically by: parsing the third authentication instruction to obtain the second signature data, the second mobile public key, the first check value, and the third timestamp, performing a time validity check using the third timestamp, and then verifying the second signature data using the first mobile public key;
[0099] The mobile terminal verifies the received fourth authentication instruction specifically by: parsing the received fourth authentication instruction to obtain a second verification value and a fourth timestamp, performing a time verification based on the fourth timestamp, and determining whether the first verification value is consistent with the second verification value; if not, the verification fails, and the process ends; if so, the verification passes;
[0100] Step S16: The mobile terminal encrypts the account, password, and device serial number into login ciphertext data using the second mobile private key and sends it to the server. The server decrypts the login ciphertext data using the second mobile public key to obtain the account, password, and device serial number. After matching and verifying the account and password, the login operation of the mobile terminal is completed, and the power output of the vehicle charger is started based on the device serial number.
[0101] The root private key and root public key are a pair of keys generated by the SM9 algorithm; the first mobile private key and the first mobile public key are a pair of keys generated by the EdDSA algorithm; the first service private key and the first service public key are a pair of keys generated by the EdDSA algorithm; the second mobile private key and the second mobile public key are a pair of keys generated by the EdDSA algorithm; the second service private key and the second service public key are a pair of keys generated by the EdDSA algorithm.
[0102] Through a multi-level CA authentication system of root certificates, mobile certificates and service certificates, combined with random numbers, timestamps and dynamic key negotiation (such as the first / second session keys), the bidirectional identity legitimacy of the mobile terminal and the server is ensured, effectively resisting the risks of man-in-the-middle attacks and counterfeit terminals, thereby effectively improving the security of charging fee settlement for on-board chargers.
[0103] The step S30 is specifically as follows:
[0104] The on-board charger presets a charging key created based on the AES256 algorithm, reads the charging plaintext data within the upload period based on a preset upload period, obtains the current fifth timestamp, performs hash calculation on the charging plaintext data and the fifth timestamp to obtain a first hash value, intercepts a character string of a preset length from the fifth timestamp according to a preset interception rule to obtain a first time parameter, concatenates the charging key and the first time parameter to obtain a first dynamic key, encrypts the charging data using the first dynamic key to obtain primary encrypted data, encrypts the primary encrypted data, the charging key, the fifth timestamp and the first hash value using the RC6 algorithm to obtain secondary encrypted data, swaps the first 3 characters with the last 3 characters of the secondary encrypted data to obtain charging ciphertext data, and uploads the charging ciphertext data to the server in real time via the SSL protocol.
[0105] By using timestamp interception to generate dynamic keys (such as the concatenation of the first time parameter and the charging key), combined with multi-layer encryption algorithms such as AES256, RC6, and IDEA, the encryption strength is significantly improved. In addition, character swapping (such as swapping the first 3 characters with the last 3 characters) increases the complexity of the ciphertext, effectively preventing replay attacks and key cracking, thereby effectively improving the security of charging fee settlement for on-board chargers.
[0106] By generating dynamic keys based on time parameters, there is no need to frequently update preset keys, which reduces the complexity of key management and improves encryption and decryption efficiency.
[0107] Through hash calculation and timestamp verification, we ensure that data has not been tampered with during transmission and storage, and is timely, thus preventing expired data from being maliciously used, thereby effectively improving the security of charging fee settlement for on-board chargers.
[0108] The step S40 is specifically as follows:
[0109] The server receives the charging ciphertext data, stores the charging ciphertext data in a designated path, swaps the first three characters with the last three characters of the charging ciphertext data to obtain level-two encrypted data, decrypts the level-two encrypted data using the RC6 algorithm to obtain level-one encrypted data, a charging key, a fifth timestamp, and a first hash value, intercepts a character string of a preset length from the fifth timestamp using a preset interception rule to obtain a first time parameter, concatenates the charging key and the first time parameter to obtain a first dynamic key, decrypts the level-one encrypted data using the first dynamic key to obtain charging plaintext data, performs an integrity check on the charging data and the fifth timestamp using the first hash value, and then performs an age check on the fifth timestamp;
[0110] Then, the charging plaintext data is parsed to obtain the charging time, charging voltage, charging current, charging temperature, SOC and positioning data. Based on the charging time, charging voltage, charging current and SOC, a charging progress report is generated that at least includes the charging time, the charged power and the estimated remaining time to fully charge. The charging progress report is displayed through a preset web page.
[0111] Generate a visual charging progress report through charging plaintext data, and display information such as charging time, charged power, and estimated remaining time to full charge in real time on the web page to optimize the user interaction experience.
[0112] The step S50 is specifically as follows:
[0113] When the vehicle charger ends charging, it generates a charging end notification carrying an encrypted message, a sixth timestamp, and a second hash value, and sends the charging end notification to the server in real time through the SSL protocol;
[0114] The encrypted message is obtained by encrypting the device serial number and the vehicle VIN code. The specific encryption process is: hashing the device serial number, the vehicle VIN code and the sixth timestamp to obtain a second hash value, intercepting a character string of a preset length from the sixth timestamp according to a preset interception rule to obtain a second time parameter, concatenating a preset charging key with the second time parameter to obtain a second dynamic key, encrypting the device serial number and the vehicle VIN code using the second dynamic key to obtain a layer of encrypted data, encrypting the first layer of encrypted data and the charging key into a second layer of encrypted data using the IDEA algorithm, and swapping the first 4 characters and the last 4 characters of the second layer of encrypted data to obtain an encrypted message; the second hash value is obtained by hashing the encrypted message and the sixth timestamp.
[0115] The step S60 is specifically as follows:
[0116] The server receives the charging end notification, parses the charging end notification to obtain an encrypted message, a sixth timestamp and a second hash value, performs an integrity check using the second hash value, performs an age check using the sixth timestamp, swaps the first 4 characters and the last 4 characters of the encrypted message to obtain two layers of encrypted data, decrypts the two layers of encrypted data using the IDEA algorithm to obtain one layer of encrypted data and a charging key, intercepts a character string of a preset length from the sixth timestamp using a preset interception rule to obtain a second time parameter, concatenates the charging key and the second time parameter to obtain a second dynamic key, decrypts the one layer of encrypted data using the second dynamic key to obtain a device serial number and a vehicle VIN code, performs a matching check on the device serial number and the vehicle VIN code using a preset device management table, calculates the charging fee based on each of the charging plaintext data, and generates a charging bill based on the charging fee.
[0117] The calculation formula for the charging fee is:
[0118] Charging cost = (charging voltage × charging current) × charging time × (basic electricity price + regional adjustment factor + time period adjustment factor) × temperature adjustment factor × SOC adjustment factor.
[0119] The step S70 is specifically as follows:
[0120] The server presets a service key created based on the SM7 algorithm, obtains the current seventh timestamp, performs hash calculation on the charging bill and the seventh timestamp to obtain a third hash value, intercepts a character string of a preset length from the seventh timestamp according to a preset interception rule to obtain a third time parameter, concatenates the service key and the third time parameter to obtain a third dynamic key, encrypts the charging bill according to the third dynamic key to obtain first encrypted data, encrypts the first encrypted data, the service key, the seventh timestamp and the third hash value according to the XTEA algorithm to obtain second encrypted data, swaps the first 5 characters and the last 5 characters of the second encrypted data to obtain an encrypted bill, and pushes the encrypted bill to the mobile terminal for settlement via the SSL protocol.
[0121] The step S80 is specifically as follows:
[0122] The server generates a charging log based on the charging plaintext data and the charging bill, obtains the current eighth timestamp, performs hash calculation on the charging log and the eighth timestamp to obtain a fourth hash value, intercepts a character string of a preset length from the eighth timestamp through a preset interception rule to obtain a fourth time parameter, concatenates the preset service key and the fourth time parameter to obtain a fourth dynamic key, encrypts the charging log through the fourth dynamic key to obtain a first ciphertext, encrypts the first ciphertext, the service key, the eighth timestamp and the fourth hash value through the AES algorithm to obtain a second ciphertext, swaps the first 6 characters and the last 6 characters of the second ciphertext to obtain an encrypted log, calculates the MAC value of the encrypted log through the HMAC algorithm as a data fingerprint, stores the encrypted log and uploads the data fingerprint to the blockchain.
[0123] By uploading the data fingerprint of the encrypted log to the chain and utilizing the tamper-proof nature of the blockchain, the charging process can be permanently traceable, enhancing the credibility of dispute resolution.
[0124] A preferred embodiment of a vehicle-mounted charger charging fee settlement system of the present invention includes the following modules:
[0125] A two-way authentication module is used for the mobile terminal to access the server through the QR code set on the car charger, perform the login operation after two-way authentication with the server, and start the power output of the car charger;
[0126] By setting up the mobile terminal to directly access the server through the QR code of the car charger, the user operation process is simplified and the usability of the device is improved.
[0127] The charging plaintext data recording module is used to record the charging plaintext data including at least charging time, charging voltage, charging current, charging temperature, SOC and positioning data in real time during the power output of the vehicle charger;
[0128] By setting the charging plaintext data to cover charging time, charging voltage, charging current, charging temperature, SOC and positioning data, the charging status can be fully monitored. Combining temperature and SOC data can warn of abnormal conditions (such as overheating or overcharging) and improve charging safety.
[0129] The charging ciphertext data uploading module is used for the on-board charger to encrypt the charging plaintext data within the upload period into charging ciphertext data based on a preset upload period, and upload the charging ciphertext data to the server via the SSL protocol;
[0130] By uploading charging ciphertext data in batches according to the preset upload cycle, the network burden caused by real-time transmission is avoided. At the same time, the transmission efficiency is optimized through the SSL protocol, balancing real-time performance and resource consumption.
[0131] a charging progress report generating module, configured to store the received charging ciphertext data on the server, decrypt and verify the charging ciphertext data to obtain charging plaintext data, generate a charging progress report based on the charging plaintext data, and display the charging progress report through a preset webpage;
[0132] The charging end notification sending module is used for the on-board charger to send a charging end notification to the server via the SSL protocol when charging is completed;
[0133] A charging bill generation module, configured to calculate the charging fee based on each of the charging plaintext data after the server verifies the received charging end notification, and generate a charging bill based on the charging fee;
[0134] The charging fee settlement module is used for the server to encrypt the charging bill into an encrypted bill and push the encrypted bill to the mobile terminal through the SSL protocol for settlement;
[0135] The charging log management module is used for the server to generate a charging log based on the charging plaintext data and the charging bill, encrypt the charging log into an encrypted log, calculate the data fingerprint of the encrypted log, store the encrypted log and upload the data fingerprint to the blockchain.
[0136] By automating the entire process from charging initiation to charging bill generation, encrypted bills are pushed to mobile terminals, reducing manual intervention and the risk of settlement errors.
[0137] Through core technology innovations such as two-way authentication, dynamic encryption, and blockchain evidence storage, a safe, efficient, and reliable on-board charger charging fee settlement system has been built, which optimizes the charging service process and user experience while ensuring data security and user privacy.
[0138] The two-way authentication module specifically includes:
[0139] A certificate initialization unit is configured to create a private key, a root certificate carrying a root public key, a first mobile private key, a first mobile public key, a first service private key, and a first service public key on the CA platform; the first mobile public key is signed with the root private key to obtain a mobile certificate; and the first service public key is signed with the root private key to obtain a service certificate;
[0140] a first authentication instruction sending unit, configured to scan a QR code provided on the vehicle charger with a mobile terminal to obtain a URL of a server and a device serial number of the vehicle charger, obtain the root certificate, mobile certificate, and first mobile private key from the CA platform, generate a first random number, obtain a current first timestamp, generate a first authentication instruction based on the mobile certificate, the first random number, and the first timestamp, and send the first authentication instruction to the server via a URL;
[0141] a second authentication instruction sending unit, configured to obtain, on the server, the root certificate, the service certificate, and the first service private key from the CA platform, parse the received first authentication instruction to obtain a mobile certificate, a first random number, and a first timestamp, perform an aging check using the first timestamp, extract a root public key from the root certificate, verify the signature of the mobile work certificate using the root public key, and then extract the first mobile public key from the mobile work certificate;
[0142] The server generates a second random number, a second service private key, and a second service public key, signs the first random number and the second service public key using the first service private key to obtain first signature data, generates a second authentication instruction carrying the first signature data, the second service public key, the service certificate, the second random number, and a second timestamp, and sends the second authentication instruction to the mobile terminal;
[0143] a third authentication instruction sending unit, configured for the mobile terminal to parse the second authentication instruction to obtain the first signature data, the second service public key, the service certificate, the second random number, and the second timestamp; after performing a time validity check using the second timestamp, extract the root public key from the root certificate; verify the signature of the service certificate using the root public key; and then extract the first service public key from the service certificate;
[0144] The mobile terminal generates a second mobile private key and a second mobile public key, negotiates a first session key with the second mobile private key and the second service public key, calculates a first check value for the first session key, signs the second random number, the second mobile public key, and the first check value using the first mobile private key to obtain second signature data, generates a third authentication instruction carrying the second signature data, the second mobile public key, the first check value, and a third timestamp, and sends the third authentication instruction to the server;
[0145] a fourth authentication instruction sending unit, configured to, after the server verifies the received third authentication instruction, negotiate a second session key using the second mobile public key and the second service private key carried in the third authentication instruction, calculate a second check value for the second session key, generate a fourth authentication instruction carrying the second check value and a fourth timestamp, and send it to the mobile terminal; after the mobile terminal verifies the received fourth authentication instruction, complete two-way authentication and establish a secure communication channel between the mobile terminal and the server; the first check value and the second check value are both MD5 values;
[0146] The server verifies the received third authentication instruction specifically by: parsing the third authentication instruction to obtain the second signature data, the second mobile public key, the first check value, and the third timestamp, performing a time validity check using the third timestamp, and then verifying the second signature data using the first mobile public key;
[0147] The mobile terminal verifies the received fourth authentication instruction specifically by: parsing the received fourth authentication instruction to obtain a second verification value and a fourth timestamp, performing a time verification based on the fourth timestamp, and determining whether the first verification value is consistent with the second verification value; if not, the verification fails, and the process ends; if so, the verification passes;
[0148] The account and password verification unit is used for the mobile terminal to encrypt the account, password and device serial number into login ciphertext data using the second mobile private key and send it to the server. The server decrypts the login ciphertext data using the second mobile public key to obtain the account, password and device serial number. After matching and verifying the account and password, the login operation of the mobile terminal is completed and the power output of the vehicle charger is started based on the device serial number.
[0149] The root private key and root public key are a pair of keys generated by the SM9 algorithm; the first mobile private key and the first mobile public key are a pair of keys generated by the EdDSA algorithm; the first service private key and the first service public key are a pair of keys generated by the EdDSA algorithm; the second mobile private key and the second mobile public key are a pair of keys generated by the EdDSA algorithm; the second service private key and the second service public key are a pair of keys generated by the EdDSA algorithm.
[0150] Through a multi-level CA authentication system of root certificates, mobile certificates and service certificates, combined with random numbers, timestamps and dynamic key negotiation (such as the first / second session keys), the bidirectional identity legitimacy of the mobile terminal and the server is ensured, effectively resisting the risks of man-in-the-middle attacks and counterfeit terminals, thereby effectively improving the security of charging fee settlement for on-board chargers.
[0151] The charging ciphertext data uploading module is specifically used for:
[0152] The on-board charger presets a charging key created based on the AES256 algorithm, reads the charging plaintext data within the upload period based on a preset upload period, obtains the current fifth timestamp, performs hash calculation on the charging plaintext data and the fifth timestamp to obtain a first hash value, intercepts a character string of a preset length from the fifth timestamp according to a preset interception rule to obtain a first time parameter, concatenates the charging key and the first time parameter to obtain a first dynamic key, encrypts the charging data using the first dynamic key to obtain primary encrypted data, encrypts the primary encrypted data, the charging key, the fifth timestamp and the first hash value using the RC6 algorithm to obtain secondary encrypted data, swaps the first 3 characters with the last 3 characters of the secondary encrypted data to obtain charging ciphertext data, and uploads the charging ciphertext data to the server in real time via the SSL protocol.
[0153] By using timestamp interception to generate dynamic keys (such as the concatenation of the first time parameter and the charging key), combined with multi-layer encryption algorithms such as AES256, RC6, and IDEA, the encryption strength is significantly improved. In addition, character swapping (such as swapping the first 3 characters with the last 3 characters) increases the complexity of the ciphertext, effectively preventing replay attacks and key cracking, thereby effectively improving the security of charging fee settlement for on-board chargers.
[0154] By generating dynamic keys based on time parameters, there is no need to frequently update preset keys, which reduces the complexity of key management and improves encryption and decryption efficiency.
[0155] Through hash calculation and timestamp verification, we ensure that data has not been tampered with during transmission and storage, and is timely, thus preventing expired data from being maliciously used, thereby effectively improving the security of charging fee settlement for on-board chargers.
[0156] The charging progress report generation module is specifically used to:
[0157] The server receives the charging ciphertext data, stores the charging ciphertext data in a designated path, swaps the first three characters with the last three characters of the charging ciphertext data to obtain level-two encrypted data, decrypts the level-two encrypted data using the RC6 algorithm to obtain level-one encrypted data, a charging key, a fifth timestamp, and a first hash value, intercepts a character string of a preset length from the fifth timestamp using a preset interception rule to obtain a first time parameter, concatenates the charging key and the first time parameter to obtain a first dynamic key, decrypts the level-one encrypted data using the first dynamic key to obtain charging plaintext data, performs an integrity check on the charging data and the fifth timestamp using the first hash value, and then performs an age check on the fifth timestamp;
[0158] Then, the charging plaintext data is parsed to obtain the charging time, charging voltage, charging current, charging temperature, SOC and positioning data. Based on the charging time, charging voltage, charging current and SOC, a charging progress report is generated that at least includes the charging time, the charged power and the estimated remaining time to fully charge. The charging progress report is displayed through a preset web page.
[0159] Generate a visual charging progress report through charging plaintext data, and display information such as charging time, charged power, and estimated remaining time to full charge in real time on the web page to optimize the user interaction experience.
[0160] The charging end notification sending module is specifically used to:
[0161] When the vehicle charger ends charging, it generates a charging end notification carrying an encrypted message, a sixth timestamp, and a second hash value, and sends the charging end notification to the server in real time through the SSL protocol;
[0162] The encrypted message is obtained by encrypting the device serial number and the vehicle VIN code. The specific encryption process is: hashing the device serial number, the vehicle VIN code and the sixth timestamp to obtain a second hash value, intercepting a character string of a preset length from the sixth timestamp according to a preset interception rule to obtain a second time parameter, concatenating a preset charging key with the second time parameter to obtain a second dynamic key, encrypting the device serial number and the vehicle VIN code using the second dynamic key to obtain a layer of encrypted data, encrypting the first layer of encrypted data and the charging key into a second layer of encrypted data using the IDEA algorithm, and swapping the first 4 characters and the last 4 characters of the second layer of encrypted data to obtain an encrypted message; the second hash value is obtained by hashing the encrypted message and the sixth timestamp.
[0163] The charging bill generation module is specifically used to:
[0164] The server receives the charging end notification, parses the charging end notification to obtain an encrypted message, a sixth timestamp and a second hash value, performs an integrity check using the second hash value, performs an age check using the sixth timestamp, swaps the first 4 characters and the last 4 characters of the encrypted message to obtain two layers of encrypted data, decrypts the two layers of encrypted data using the IDEA algorithm to obtain one layer of encrypted data and a charging key, intercepts a character string of a preset length from the sixth timestamp using a preset interception rule to obtain a second time parameter, concatenates the charging key and the second time parameter to obtain a second dynamic key, decrypts the one layer of encrypted data using the second dynamic key to obtain a device serial number and a vehicle VIN code, performs a matching check on the device serial number and the vehicle VIN code using a preset device management table, calculates the charging fee based on each of the charging plaintext data, and generates a charging bill based on the charging fee.
[0165] The calculation formula for the charging fee is:
[0166] Charging cost = (charging voltage × charging current) × charging time × (basic electricity price + regional adjustment factor + time period adjustment factor) × temperature adjustment factor × SOC adjustment factor.
[0167] The charging fee settlement module is specifically used to:
[0168] The server presets a service key created based on the SM7 algorithm, obtains the current seventh timestamp, performs hash calculation on the charging bill and the seventh timestamp to obtain a third hash value, intercepts a character string of a preset length from the seventh timestamp according to a preset interception rule to obtain a third time parameter, concatenates the service key and the third time parameter to obtain a third dynamic key, encrypts the charging bill according to the third dynamic key to obtain first encrypted data, encrypts the first encrypted data, the service key, the seventh timestamp and the third hash value according to the XTEA algorithm to obtain second encrypted data, swaps the first 5 characters and the last 5 characters of the second encrypted data to obtain an encrypted bill, and pushes the encrypted bill to the mobile terminal for settlement via the SSL protocol.
[0169] The charging log management module is specifically used to:
[0170] The server generates a charging log based on the charging plaintext data and the charging bill, obtains the current eighth timestamp, performs hash calculation on the charging log and the eighth timestamp to obtain a fourth hash value, intercepts a character string of a preset length from the eighth timestamp through a preset interception rule to obtain a fourth time parameter, concatenates the preset service key and the fourth time parameter to obtain a fourth dynamic key, encrypts the charging log through the fourth dynamic key to obtain a first ciphertext, encrypts the first ciphertext, the service key, the eighth timestamp and the fourth hash value through the AES algorithm to obtain a second ciphertext, swaps the first 6 characters and the last 6 characters of the second ciphertext to obtain an encrypted log, calculates the MAC value of the encrypted log through the HMAC algorithm as a data fingerprint, stores the encrypted log and uploads the data fingerprint to the blockchain.
[0171] By uploading the data fingerprint of the encrypted log to the chain and utilizing the tamper-proof nature of the blockchain, the charging process can be permanently traceable, enhancing the credibility of dispute resolution.
[0172] In summary, the advantages of the present invention are:
[0173] 1. Use the QR code on the car charger to access the server through a mobile terminal, perform a two-way authentication with the server, and log in to start the power output of the car charger. During the power output process of the car charger, the charging plaintext data is recorded in real time, and the charging plaintext data within the upload cycle is encrypted into charging ciphertext data and uploaded to the server. The server decrypts and verifies the charging ciphertext data to obtain the charging plaintext data, and generates a charging progress report based on the charging plaintext data and displays it on a preset web page. When charging is finished, the car charger sends a charging end notification to the server. After verifying the charging end notification, the server calculates the charging cost based on each charging plaintext data, generates a charging bill based on the charging cost, and encrypts the charging bill into an encrypted bill. Push to the mobile terminal for settlement; and the server generates a charging log based on the plaintext data of each charging and the charging bill, encrypts the charging log into an encrypted log, calculates the data fingerprint of the encrypted log, stores the encrypted log and uploads the data fingerprint to the blockchain; that is, before using the on-board charger for charging, the mobile terminal first performs two-way authentication with the server, and charging is started only after the authentication is passed. In addition, throughout the life cycle of the on-board charger, the uploading of the charging plaintext data, the sending of the charging end notification, the sending of the charging bill and the storage of the charging log all adopt multiple encryption combined with dynamic keys, and combined with integrity verification, which can effectively prevent the relevant data from being stolen and tampered with in plain text, and ultimately greatly improve the security of the charging fee settlement of the on-board charger.
[0174] 2. Through the multi-level CA authentication system of root certificate, mobile certificate and service certificate, combined with random numbers, timestamps and dynamic key negotiation (such as the first / second session key), the bidirectional identity legitimacy of the mobile terminal and the server is ensured, effectively resisting the risks of man-in-the-middle attacks and counterfeit terminals, thereby effectively improving the security of charging fee settlement for on-board chargers.
[0175] 3. By using timestamp interception to generate dynamic keys (such as splicing the first time parameter with the charging key), combined with multi-layer encryption algorithms such as AES256, RC6, and IDEA, the encryption strength is significantly improved. In addition, character swapping (such as swapping the first 3 characters with the last 3 characters) increases the complexity of the ciphertext, effectively preventing replay attacks and key cracking, thereby effectively improving the security of charging fee settlement for on-board chargers.
[0176] 4. Through hash calculation and timestamp verification, it is ensured that the data has not been tampered with during transmission and storage, and is timely, to prevent expired data from being maliciously used, thereby effectively improving the security of charging fee settlement for on-board chargers.
[0177] 5. By uploading the data fingerprint of the encrypted log to the chain and utilizing the tamper-proof nature of the blockchain, the charging process can be permanently traced, enhancing the credibility of dispute resolution.
[0178] 6. By uploading charging ciphertext data in batches according to the preset upload cycle, the network burden caused by real-time transmission is avoided. At the same time, the transmission efficiency is optimized through the SSL protocol to balance real-time performance and resource consumption.
[0179] 7. Dynamic keys are generated based on time parameters, eliminating the need to frequently update preset keys, reducing the complexity of key management and improving encryption and decryption efficiency.
[0180] 8. Generate a visual charging progress report based on the charging plaintext data, and display the charging time, charged power, estimated remaining time to full charge and other information in real time on the web page to optimize the user interaction experience.
[0181] 9. By setting the charging plaintext data to cover charging time, charging voltage, charging current, charging temperature, SOC and positioning data, the charging status can be fully monitored. Combining temperature and SOC data can warn of abnormal conditions (such as overheating or overcharging) and improve charging safety.
[0182] 10. By automating the entire process from charging initiation to charging bill generation, and pushing encrypted bills to mobile terminals, manual intervention is reduced and the risk of settlement errors is lowered.
[0183] 11. By setting up the mobile terminal to directly access the server through the QR code of the car charger, the user operation process is simplified and the usability of the device is improved.
[0184] 12. Through core technological innovations such as two-way authentication, dynamic encryption, and blockchain evidence storage, a safe, efficient, and reliable on-board charger charging fee settlement system has been built, which optimizes the charging service process and user experience while ensuring data security and user privacy.
[0185] Although the specific embodiments of the present invention are described above, those skilled in the art should understand that the specific embodiments described are merely illustrative and are not intended to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should be included within the scope of protection of the claims of the present invention.
Claims
1. A method for settling charging fees for a vehicle-mounted charger, characterized by: The steps include: Step S10: The mobile terminal accesses the server through the QR code on the on-board charger, performs a login operation after performing two-way authentication with the server, and starts the power output of the on-board charger; Step S20: During the power output process of the vehicle charger, the charging plaintext data including at least the charging time, charging voltage, charging current, charging temperature, SOC, and positioning data are recorded in real time; Step S30: The onboard charger encrypts the charging plaintext data in the upload period into charging ciphertext data based on a preset upload period, and uploads the charging ciphertext data to the server via the SSL protocol; Step S40: The server stores the received charging ciphertext data, decrypts and verifies the charging ciphertext data to obtain charging plaintext data, generates a charging progress report based on the charging plaintext data, and displays the charging progress report through a preset webpage; Step S50: When the vehicle charger finishes charging, it sends a charging completion notification to the server via the SSL protocol; Step S60: After verifying the received charging end notification, the server calculates the charging fee based on each of the charging plaintext data, and generates a charging bill based on the charging fee; Step S70: The server encrypts the charging bill into an encrypted bill, and pushes the encrypted bill to the mobile terminal via the SSL protocol for settlement; Step S80: The server generates a charging log based on the plaintext charging data and the charging bill, encrypts the charging log into an encrypted log, calculates the data fingerprint of the encrypted log, stores the encrypted log, and uploads the data fingerprint to the blockchain.
2. A method for settling charging fees for a vehicle-mounted charger according to claim 1, characterized in that: The step S10 specifically includes: Step S11: The CA platform creates a private key, a root certificate carrying a root public key, a first mobile private key, a first mobile public key, a first service private key, and a first service public key. The first mobile public key is signed with the root private key to obtain a mobile certificate. The first service public key is signed with the root private key to obtain a service certificate. Step S12: The mobile terminal scans the QR code on the vehicle charger to obtain the URL of the server and the device serial number of the vehicle charger, obtains the root certificate, mobile certificate, and first mobile private key from the CA platform, generates a first random number, obtains the current first timestamp, generates a first authentication instruction based on the mobile certificate, the first random number, and the first timestamp, and sends the first authentication instruction to the server via the URL; Step S13: The server obtains the root certificate, service certificate, and first service private key from the CA platform, parses the received first authentication instruction to obtain the mobile certificate, the first random number, and the first timestamp, performs a validity check using the first timestamp, extracts the root public key from the root certificate, verifies the signature of the mobile work certificate using the root public key, and then extracts the first mobile public key from the mobile work certificate. The server generates a second random number, a second service private key, and a second service public key, signs the first random number and the second service public key using the first service private key to obtain first signature data, generates a second authentication instruction carrying the first signature data, the second service public key, the service certificate, the second random number, and a second timestamp, and sends the second authentication instruction to the mobile terminal; Step S14: The mobile terminal parses the second authentication instruction to obtain the first signature data, the second service public key, the service certificate, the second random number, and the second timestamp. After performing a time validity check using the second timestamp, the mobile terminal extracts the root public key from the root certificate, verifies the service certificate using the root public key, and then extracts the first service public key from the service certificate. The mobile terminal generates a second mobile private key and a second mobile public key, negotiates a first session key with the second mobile private key and the second service public key, calculates a first check value for the first session key, signs the second random number, the second mobile public key, and the first check value using the first mobile private key to obtain second signature data, generates a third authentication instruction carrying the second signature data, the second mobile public key, the first check value, and a third timestamp, and sends the third authentication instruction to the server; Step S15: After verifying the received third authentication instruction, the server negotiates a second session key using the second mobile public key and the second service private key carried in the third authentication instruction, calculates a second check value for the second session key, generates a fourth authentication instruction carrying the second check value and a fourth timestamp, and sends it to the mobile terminal. After the mobile terminal verifies the received fourth authentication instruction, bidirectional authentication is completed, and a secure communication channel is established between the mobile terminal and the server. Step S16: The mobile terminal encrypts the account, password, and device serial number into login ciphertext data using the second mobile private key and sends it to the server. The server decrypts the login ciphertext data using the second mobile public key to obtain the account, password, and device serial number. After matching and verifying the account and password, the login operation of the mobile terminal is completed, and the power output of the vehicle charger is started based on the device serial number.
3. The method for settling charging fees for a vehicle-mounted charger according to claim 1, wherein: The step S30 is specifically as follows: The on-board charger presets a charging key created based on the AES256 algorithm, reads the charging plaintext data within the upload period based on a preset upload period, obtains the current fifth timestamp, performs hash calculation on the charging plaintext data and the fifth timestamp to obtain a first hash value, intercepts a character string of a preset length from the fifth timestamp according to a preset interception rule to obtain a first time parameter, concatenates the charging key and the first time parameter to obtain a first dynamic key, encrypts the charging data using the first dynamic key to obtain primary encrypted data, encrypts the primary encrypted data, the charging key, the fifth timestamp and the first hash value using the RC6 algorithm to obtain secondary encrypted data, swaps the first 3 characters with the last 3 characters of the secondary encrypted data to obtain charging ciphertext data, and uploads the charging ciphertext data to the server in real time via the SSL protocol.
4. The method for settling charging fees for a vehicle-mounted charger according to claim 1, wherein: The step S40 is specifically as follows: The server receives the charging ciphertext data, stores the charging ciphertext data in a designated path, swaps the first three characters with the last three characters of the charging ciphertext data to obtain level-two encrypted data, decrypts the level-two encrypted data using the RC6 algorithm to obtain level-one encrypted data, a charging key, a fifth timestamp, and a first hash value, intercepts a character string of a preset length from the fifth timestamp using a preset interception rule to obtain a first time parameter, concatenates the charging key and the first time parameter to obtain a first dynamic key, decrypts the level-one encrypted data using the first dynamic key to obtain charging plaintext data, performs an integrity check on the charging data and the fifth timestamp using the first hash value, and then performs an age check on the fifth timestamp; Then, the charging plaintext data is parsed to obtain the charging time, charging voltage, charging current, charging temperature, SOC and positioning data. Based on the charging time, charging voltage, charging current and SOC, a charging progress report is generated that at least includes the charging time, the charged power and the estimated remaining time to fully charge. The charging progress report is displayed through a preset web page.
5. The method for settling charging fees for a vehicle-mounted charger according to claim 1, wherein: The step S50 is specifically as follows: When the vehicle charger ends charging, it generates a charging end notification carrying an encrypted message, a sixth timestamp, and a second hash value, and sends the charging end notification to the server in real time through the SSL protocol; The encrypted message is obtained by encrypting the device serial number and the vehicle VIN code. The specific encryption process is: hashing the device serial number, the vehicle VIN code and the sixth timestamp to obtain a second hash value, intercepting a character string of a preset length from the sixth timestamp according to a preset interception rule to obtain a second time parameter, concatenating a preset charging key with the second time parameter to obtain a second dynamic key, encrypting the device serial number and the vehicle VIN code using the second dynamic key to obtain a layer of encrypted data, encrypting the first layer of encrypted data and the charging key into a second layer of encrypted data using the IDEA algorithm, and swapping the first 4 characters and the last 4 characters of the second layer of encrypted data to obtain an encrypted message; the second hash value is obtained by hashing the encrypted message and the sixth timestamp.
6. A charging fee settlement system for a vehicle-mounted charger, characterized by: Includes the following modules: A two-way authentication module is used for the mobile terminal to access the server through the QR code set on the car charger, perform the login operation after two-way authentication with the server, and start the power output of the car charger; The charging plaintext data recording module is used to record the charging plaintext data including at least charging time, charging voltage, charging current, charging temperature, SOC and positioning data in real time during the power output of the vehicle charger; The charging ciphertext data uploading module is used for the on-board charger to encrypt the charging plaintext data within the upload period into charging ciphertext data based on a preset upload period, and upload the charging ciphertext data to the server via the SSL protocol; a charging progress report generating module, configured to store the received charging ciphertext data on the server, decrypt and verify the charging ciphertext data to obtain charging plaintext data, generate a charging progress report based on the charging plaintext data, and display the charging progress report through a preset webpage; The charging end notification sending module is used for the on-board charger to send a charging end notification to the server via the SSL protocol when charging is completed; A charging bill generation module, configured to calculate the charging fee based on each of the charging plaintext data after the server verifies the received charging end notification, and generate a charging bill based on the charging fee; The charging fee settlement module is used for the server to encrypt the charging bill into an encrypted bill and push the encrypted bill to the mobile terminal through the SSL protocol for settlement; The charging log management module is used for the server to generate a charging log based on the charging plaintext data and the charging bill, encrypt the charging log into an encrypted log, calculate the data fingerprint of the encrypted log, store the encrypted log and upload the data fingerprint to the blockchain.
7. The vehicle-mounted charger charging fee settlement system according to claim 6, characterized in that: The two-way authentication module specifically includes: A certificate initialization unit is configured to create a private key, a root certificate carrying a root public key, a first mobile private key, a first mobile public key, a first service private key, and a first service public key on the CA platform; the first mobile public key is signed with the root private key to obtain a mobile certificate; and the first service public key is signed with the root private key to obtain a service certificate; a first authentication instruction sending unit, configured to scan a QR code provided on the vehicle charger with a mobile terminal to obtain a URL of a server and a device serial number of the vehicle charger, obtain the root certificate, mobile certificate, and first mobile private key from the CA platform, generate a first random number, obtain a current first timestamp, generate a first authentication instruction based on the mobile certificate, the first random number, and the first timestamp, and send the first authentication instruction to the server via a URL; a second authentication instruction sending unit, configured to obtain, on the server, the root certificate, the service certificate, and the first service private key from the CA platform, parse the received first authentication instruction to obtain a mobile certificate, a first random number, and a first timestamp, perform an aging check using the first timestamp, extract a root public key from the root certificate, verify the signature of the mobile work certificate using the root public key, and then extract the first mobile public key from the mobile work certificate; The server generates a second random number, a second service private key, and a second service public key, signs the first random number and the second service public key using the first service private key to obtain first signature data, generates a second authentication instruction carrying the first signature data, the second service public key, the service certificate, the second random number, and a second timestamp, and sends the second authentication instruction to the mobile terminal; a third authentication instruction sending unit, configured for the mobile terminal to parse the second authentication instruction to obtain the first signature data, the second service public key, the service certificate, the second random number, and the second timestamp; after performing a time validity check using the second timestamp, extract the root public key from the root certificate; verify the signature of the service certificate using the root public key; and then extract the first service public key from the service certificate; The mobile terminal generates a second mobile private key and a second mobile public key, negotiates a first session key with the second mobile private key and the second service public key, calculates a first check value for the first session key, signs the second random number, the second mobile public key, and the first check value using the first mobile private key to obtain second signature data, generates a third authentication instruction carrying the second signature data, the second mobile public key, the first check value, and a third timestamp, and sends the third authentication instruction to the server; a fourth authentication instruction sending unit, configured to, after the server verifies the received third authentication instruction, negotiate a second session key using the second mobile public key and the second service private key carried in the third authentication instruction, calculate a second check value for the second session key, generate a fourth authentication instruction carrying the second check value and a fourth timestamp, and send it to the mobile terminal; after the mobile terminal verifies the received fourth authentication instruction, complete two-way authentication and establish a secure communication channel between the mobile terminal and the server; The account and password verification unit is used for the mobile terminal to encrypt the account, password and device serial number into login ciphertext data using the second mobile private key and send it to the server. The server decrypts the login ciphertext data using the second mobile public key to obtain the account, password and device serial number. After matching and verifying the account and password, the login operation of the mobile terminal is completed and the power output of the vehicle charger is started based on the device serial number.
8. The vehicle-mounted charger charging fee settlement system according to claim 6, characterized in that: The charging ciphertext data uploading module is specifically used for: The on-board charger presets a charging key created based on the AES256 algorithm, reads the charging plaintext data within the upload period based on a preset upload period, obtains the current fifth timestamp, performs hash calculation on the charging plaintext data and the fifth timestamp to obtain a first hash value, intercepts a character string of a preset length from the fifth timestamp according to a preset interception rule to obtain a first time parameter, concatenates the charging key and the first time parameter to obtain a first dynamic key, encrypts the charging data using the first dynamic key to obtain primary encrypted data, encrypts the primary encrypted data, the charging key, the fifth timestamp and the first hash value using the RC6 algorithm to obtain secondary encrypted data, swaps the first 3 characters with the last 3 characters of the secondary encrypted data to obtain charging ciphertext data, and uploads the charging ciphertext data to the server in real time via the SSL protocol.
9. The vehicle-mounted charger charging fee settlement system according to claim 6, characterized in that: The charging progress report generation module is specifically used to: The server receives the charging ciphertext data, stores the charging ciphertext data in a designated path, swaps the first three characters with the last three characters of the charging ciphertext data to obtain level-two encrypted data, decrypts the level-two encrypted data using the RC6 algorithm to obtain level-one encrypted data, a charging key, a fifth timestamp, and a first hash value, intercepts a character string of a preset length from the fifth timestamp using a preset interception rule to obtain a first time parameter, concatenates the charging key and the first time parameter to obtain a first dynamic key, decrypts the level-one encrypted data using the first dynamic key to obtain charging plaintext data, performs an integrity check on the charging data and the fifth timestamp using the first hash value, and then performs an age check on the fifth timestamp; Then, the charging plaintext data is parsed to obtain the charging time, charging voltage, charging current, charging temperature, SOC and positioning data. Based on the charging time, charging voltage, charging current and SOC, a charging progress report is generated that at least includes the charging time, the charged power and the estimated remaining time to fully charge. The charging progress report is displayed through a preset web page.
10. The vehicle-mounted charger charging fee settlement system according to claim 6, characterized in that: The charging end notification sending module is specifically used to: When the vehicle charger ends charging, it generates a charging end notification carrying an encrypted message, a sixth timestamp, and a second hash value, and sends the charging end notification to the server in real time through the SSL protocol; The encrypted message is obtained by encrypting the device serial number and the vehicle VIN code. The specific encryption process is: hashing the device serial number, the vehicle VIN code and the sixth timestamp to obtain a second hash value, intercepting a character string of a preset length from the sixth timestamp according to a preset interception rule to obtain a second time parameter, concatenating a preset charging key with the second time parameter to obtain a second dynamic key, encrypting the device serial number and the vehicle VIN code using the second dynamic key to obtain a layer of encrypted data, encrypting the first layer of encrypted data and the charging key into a second layer of encrypted data using the IDEA algorithm, and swapping the first 4 characters and the last 4 characters of the second layer of encrypted data to obtain an encrypted message; the second hash value is obtained by hashing the encrypted message and the sixth timestamp.