Internet of vehicles platform message transmission method and system
By using numerical preset encryption operations and XOR operations from beginning to end to generate encryption check codes during the command transmission process of the Internet of Vehicles platform, the problem of low security in message transmission on the Internet of Vehicles platform is solved, and data efficiency and data are achieved. Secure transmission.
Patent Information
- Application Number
- CN202410856392.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-10-08
AI Technical Summary
The Internet of Vehicles platform has low security issues during the message transmission process. Data is not encrypted when transmitted between the application, cloud and vehicle, leading to the risk of data leakage.
During the instruction transmission process, the preset encryption operation is performed using the values from the beginning to the end, the encryption check code is generated through the XOR operation, and encryption and decryption are performed at each node to ensure the integrity and security of the data.
Significantly improves the security of message transmission, ensures the accuracy of data verification, and ensures the integrity and reliability of instructions under unstable network conditions.
Smart Images

Figure CN118748686A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of vehicle networking communication technology, and in particular to a vehicle networking platform message transmission method and system. Background Art
[0002] With the digital transformation of automobiles, Internet of Vehicles big data plays an increasingly important role in the development of business. More accurate, faster and richer Internet of Vehicles services can better capture users. However, faced with such a huge amount of control signals and data, how to ensure efficient and stable transmission of messages is a common problem in the industry. Therefore, a cross-platform architecture has been introduced, including the vehicle side, cloud side, and application side, so that data can be transmitted efficiently, stably and accurately between the three sides without affecting the user experience. In general, users use the application side to output control instructions to the vehicle side, control instructions to the cloud server, and forward the control instructions to the vehicle side through the cloud server. In this process, the data is often not encrypted, resulting in low data security and the risk of data leakage. Summary of the invention
[0003] In view of this, the present invention provides a method and system for transmitting messages on an Internet of Vehicles platform to solve the problem of low security of message transmission on the Internet of Vehicles platform.
[0004] In the first aspect, the present invention provides a method for transmitting messages on an Internet of Vehicles platform, which is applied to an Internet of Vehicles platform message transmission system, wherein the Internet of Vehicles platform message transmission system includes an application end, a cloud end, and a vehicle end; the application end generates an application instruction, and uses the numerical values of the application instruction from the beginning to the end to perform a preset encryption operation to obtain a first encrypted instruction; the application end sends the first encrypted instruction to the cloud end; the cloud end decrypts the first encrypted instruction through an inverse operation of the preset encryption operation to obtain the application instruction; the cloud end generates a vehicle control instruction thread based on the application instruction, and performs instruction flow processing through the vehicle control instruction thread; the cloud end performs a preset encryption operation on the transferred vehicle control instruction according to the numerical values from the beginning to the end to obtain a second encrypted instruction; the cloud end sends the second encrypted instruction to the vehicle end; the vehicle end receives the second encrypted instruction, and decrypts the second encrypted instruction through an inverse operation of the preset encryption operation to obtain the vehicle control instruction; the vehicle end executes the vehicle control instruction.
[0005] According to the above-mentioned technical means, the present invention performs a preset encryption operation according to the numerical value from the beginning to the end of the instruction during the instruction transmission process, so that the encrypted ciphertext strictly introduces the influence of each bit of data, so that as long as any bit of data in the instruction is tampered with, the original ciphertext and the ciphertext of the tampered data will definitely be inconsistent, thereby improving the accuracy of data verification and significantly enhancing the security of message transmission.
[0006] In an optional implementation, the step of executing a preset encryption operation on the application side or the cloud side includes: dividing the data to be encrypted into multiple data segments of equal length from the beginning to the end, and the data to be encrypted is an application instruction or a vehicle control instruction; starting from the head of the data to be encrypted, performing an XOR operation on the first data segment and the second data segment to obtain an XOR result; starting from the third data segment, each time performing an XOR operation on the current data segment and the previous XOR result to obtain a new XOR result, until the last data segment at the end is calculated to obtain an encryption check code; adding the length information and the encryption check code to both ends of the data to be encrypted respectively to obtain the encrypted data, the length information is the data length of the encrypted data, and the encrypted data is the first encryption instruction or the second encryption instruction.
[0007] According to the above technical means, a method is provided to segment the original data, and based on the XOR result of the first segment of data and the second segment of data, each time the previous XOR result and the next segment of data are XORed to obtain an encryption check code. The combination of the encryption check code and the original text makes the confidentiality of the encryption instruction higher, and because the calculation process does not have complex calculations, the calculation efficiency is high, thereby taking into account the overall efficiency and security of data transmission.
[0008] In an optional implementation, the steps of the inverse operation of the preset encryption operation performed by the cloud or vehicle include: verifying the length of the encrypted data according to the length information; if the length check passes, extracting the remaining data from the encrypted data without the length information and the encryption check code; performing the preset encryption operation on the remaining data to obtain the verification code; comparing the verification code and the encryption check code; if the comparison is consistent, using the remaining data as decrypted data, and the decrypted data is an application instruction or a vehicle control instruction; if the comparison is inconsistent, terminating the message transmission process.
[0009] According to the above technical means, the encryption method based on XOR cloud provides a new decryption method accordingly.
[0010] In an optional implementation, the cloud generates a vehicle control instruction thread based on application instructions, and performs instruction flow processing through the vehicle control instruction thread, including: the cloud generates a vehicle control instruction thread based on application instructions; storing the vehicle control instruction thread in a thread pool created based on a circular queue; and processing the vehicle control instruction threads in the thread pool in sequence according to the order of the circular queue.
[0011] According to the above technical means, a thread pool is created based on a circular queue in the instruction flow link, thereby solving the problem of memory space waste caused by the thread pool.
[0012] In an optional implementation, before the vehicle side receives the second encrypted instruction, it also includes: the cloud caches the second encrypted instruction locally; when no confirmation information is received from the vehicle side within a preset response timeout period, the cloud replies with an execution timeout information to the application side, and marks the second encrypted instruction as an instruction that failed to be sent by the cloud, and the confirmation information is used to confirm that the vehicle side has received the second encrypted instruction; when the cloud detects the online information of the vehicle side, it queries whether the vehicle side has an instruction that failed to be sent; the queried second encrypted instruction is resent to the vehicle side; when confirmation information is received from the vehicle side within a preset response timeout period, the cloud replies with an execution success information to the application side.
[0013] According to the above-mentioned technical means, it is achieved that the instructions will not be lost, and the execution and feedback of vehicle control instructions can be completed even when the vehicle is offline. In the case of unstable cellular network or even network disconnection, the accuracy of data is guaranteed.
[0014] In a second aspect, the present invention provides a method for transmitting messages on an Internet of Vehicles platform, which is applied to an application end. The method includes: generating an application instruction, and performing a preset encryption operation using the numerical values from the beginning to the end of the application instruction to obtain a first encrypted instruction; and sending the first encrypted instruction to the cloud.
[0015] In an optional implementation, a preset encryption operation is performed using the numerical value of the application instruction from the beginning to the end to obtain a first encryption instruction, including: dividing the application instruction from the beginning to the end into multiple data segments of equal length; starting from the head of the application instruction, performing an XOR operation on the first data segment and the second data segment to obtain an XOR result; starting from the third data segment, each time the current data segment is XORed with the previous XOR result to obtain a new XOR result, until the last data segment at the end is calculated to obtain a first encryption check code; the first length information and the first encryption check code are respectively added to both ends of the application instruction to obtain the first encryption instruction, and the first length information is the data length of the first encryption instruction.
[0016] In the third aspect, the present invention provides a method for transmitting messages on an Internet of Vehicles platform, which is applied to the cloud. The method includes: receiving a first encrypted instruction sent by an application end, the first encrypted instruction is obtained by the application end using the numerical values from the beginning to the end of the application instruction to perform a preset encryption operation, and the application instruction is an instruction generated by the application end; decrypting the first encrypted instruction by performing an inverse operation of the preset encryption operation to obtain the application instruction; generating a vehicle control instruction thread based on the application instruction, and performing instruction flow processing through the vehicle control instruction thread; performing a preset encryption operation on the circulated vehicle control instruction according to the numerical values from the beginning to the end to obtain a second encrypted instruction; and sending the second encrypted instruction to the vehicle end.
[0017] In an optional implementation, a preset encryption operation is performed on the circulated vehicle control instruction according to the numerical values from the beginning to the end to obtain a second encrypted instruction, including: dividing the vehicle control instruction from the beginning to the end into multiple data segments of equal length; starting from the header of the vehicle control instruction, using the first data segment and the second data segment to perform an XOR operation to obtain an XOR result; starting from the third data segment, each time the current data segment is XORed with the previous XOR result to obtain a new XOR result, until the last data segment at the end is calculated to obtain a second encryption verification code; the second length information and the second encryption verification code are respectively added to both ends of the vehicle control instruction to obtain a second encrypted instruction, and the second length information is the data length of the second encrypted instruction.
[0018] In an optional implementation, the first encryption instruction is decrypted by an inverse operation of a preset encryption operation to obtain an application instruction, including: verifying the length of the first encryption instruction according to first length information at the end of the first encryption instruction, the first length information being the length of the first encryption instruction counted when the application end creates the first encryption instruction; if the length check passes, removing the first length information and the first encryption check code at both ends of the first encryption instruction to obtain the remaining data, the first encryption check code being the encryption check code generated when the application end performs a preset encryption operation on the application instruction; performing a preset encryption operation on the remaining data to obtain a verification check code; comparing the verification check code and the first encryption check code; if the comparison is consistent, using the remaining data as the application instruction; if the comparison is inconsistent, terminating the current message transmission process.
[0019] In an optional implementation, a vehicle control instruction thread is generated based on application instructions, and instruction flow processing is performed through the vehicle control instruction thread, including: generating a vehicle control instruction thread based on application instructions; storing the vehicle control instruction thread in a thread pool created based on a circular queue; and processing the vehicle control instruction threads in the thread pool in sequence according to the order of the circular queue.
[0020] In an optional implementation, after sending the second encrypted instruction to the vehicle side, it also includes: caching the second encrypted instruction locally; when no confirmation information is received from the vehicle side within a preset response timeout period, replying execution timeout information to the application side, and marking the second encrypted instruction as an instruction that failed to be sent from the cloud, and the confirmation information is used to confirm that the vehicle side has received the second encrypted instruction; when online information of the vehicle side is detected, querying whether the vehicle side has an instruction that failed to be sent; resending the queried second encrypted instruction to the vehicle side; when confirmation information is received from the vehicle side within a preset response timeout period, replying execution success information to the application side.
[0021] In a fourth aspect, the present invention provides a vehicle networking platform message transmission system, including an application end, a cloud end and a vehicle end, wherein the application end and the cloud end are communicatively connected, and the cloud end and the vehicle end are communicatively connected.
[0022] The technical solution provided by the present invention has the following advantages:
[0023] (1) According to the above technical means, the present invention performs a preset encryption operation according to the numerical value from the beginning to the end of the instruction during the instruction transmission process, so that the encrypted ciphertext strictly introduces the influence of each bit of data, so that as long as any bit of data in the instruction is tampered with, the original ciphertext and the ciphertext of the tampered data will definitely be inconsistent, thereby improving the accuracy of data verification and significantly enhancing the security of message transmission.
[0024] (2) According to the above technical means, a method is provided to segment the original data, and based on the XOR result of the first segment of data and the second segment of data, each time the previous XOR result is XORed with the next segment of data to obtain an encryption check code. The encryption check code and the original text are combined to make the encryption instruction more confidential, and because the calculation process is not overly complicated, the calculation efficiency is high, thereby taking into account the overall efficiency and security of data transmission.
[0025] (3) According to the above technical means, the encryption method based on XOR cloud provides a new decryption method accordingly.
[0026] (4) According to the above technical means, a thread pool is created based on a circular queue in the instruction flow link, thereby solving the problem of memory space waste caused by the thread pool.
[0027] (5) Based on the above technical means, it is achieved that the instructions will not be lost. Even when the vehicle is offline, the execution and feedback of the vehicle control instructions can be completed. In the case of unstable cellular network or even network disconnection, the accuracy of the data is guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0029] Figure 1 It is a flowchart of a method for transmitting messages on an Internet of Vehicles platform according to an embodiment of the present invention;
[0030] Figure 2 is a schematic diagram of the effect of encrypting data according to an embodiment of the present invention;
[0031] Figure 3 is a schematic diagram of the thread pool effect according to an embodiment of the present invention;
[0032] Figure 4is another flowchart of a method for transmitting messages on an Internet of Vehicles platform according to an embodiment of the present invention;
[0033] Figure 5 is another flowchart of a method for transmitting messages on an Internet of Vehicles platform according to an embodiment of the present invention;
[0034] Figure 6 It is a structural schematic diagram of a vehicle networking platform message transmission system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0035] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0036] According to an embodiment of the present invention, an embodiment of a method for transmitting messages on an Internet of Vehicles platform is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0037] In this embodiment, a method for transmitting messages on an Internet of Vehicles platform is provided, which can be used in an Internet of Vehicles platform message transmission system. The Internet of Vehicles platform message transmission system includes an application end, a cloud end, and a vehicle end. Figure 1 is a flow chart of a method for transmitting messages on an Internet of Vehicles platform according to an embodiment of the present invention, the process comprising the following steps:
[0038] Step S101, the application terminal generates an application instruction, and performs a preset encryption operation using the numerical values from the beginning to the end of the application instruction to obtain a first encrypted instruction;
[0039] Step S102, the application sends the first encryption instruction to the cloud;
[0040] Step S103, the cloud decrypts the first encrypted instruction by performing an inverse operation of a preset encryption operation to obtain an application instruction;
[0041] Step S104: the cloud generates a vehicle control instruction thread based on the application instruction, and performs instruction flow processing through the vehicle control instruction thread;
[0042] Step S105, the cloud performs a preset encryption operation on the transferred vehicle control instruction according to the values from the beginning to the end to obtain a second encrypted instruction;
[0043] Step S106, the cloud sends the second encrypted instruction to the vehicle end;
[0044] Step S107, the vehicle end receives the second encrypted instruction, and decrypts the second encrypted instruction by an inverse operation of a preset encryption operation to obtain a vehicle control instruction;
[0045] Step S108, the vehicle side executes the vehicle control command.
[0046] Specifically, the present invention performs preset encryption operations based on the values of the instructions from the beginning to the end for the instruction transmission process in which the application end sends instructions to the cloud and the cloud end forwards instructions to the vehicle end. The encryption algorithm includes but is not limited to using each value of the instruction from the beginning to the end to perform mathematical operations such as "addition, subtraction, multiplication and division" or logical operations such as "AND or NOT". This is just an example and is not limited to this. As a result, the encrypted ciphertext strictly introduces the influence of each bit of data, so that as long as any bit of data in the instruction is tampered with, the original ciphertext and the ciphertext calculated by the tampered data must be inconsistent. When the encrypted instruction is verified on the cloud or vehicle end, if it is determined that the original ciphertext and the ciphertext calculated by the tampered data are inconsistent, the instruction transmission process is notified, which significantly improves the accuracy of data verification, thereby significantly enhancing the security of message transmission.
[0047] In some optional implementations, the step of the application end or the cloud end performing a preset encryption operation in the above steps S101 and S105 includes:
[0048] Step a1, dividing the data to be encrypted into a plurality of data segments of equal length from the beginning to the end, wherein the data to be encrypted is an application instruction or a vehicle control instruction;
[0049] Step a2, starting from the header of the data to be encrypted, using the first data segment and the second data segment to perform an XOR operation to obtain an XOR result;
[0050] Step a3, starting from the third data segment, each time the current data segment is XORed with the previous XOR result to obtain a new XOR result, until the last data segment at the end is calculated to obtain the encryption check code;
[0051] Step a4, adding the length information and the encryption check code to both ends of the data to be encrypted respectively to obtain the encrypted data, the length information is the data length of the encrypted data, and the encrypted data is the first encryption instruction or the second encryption instruction.
[0052] Specifically, in the present embodiment, the logic of the application end encrypting the application instructions and the cloud end encrypting the vehicle control instructions are all implemented through the above-mentioned steps a1 to a4. For the data to be encrypted, the present embodiment first compresses the data to be encrypted to obtain data in byte form, and then divides the data to be encrypted into multiple data segments of equal length from the beginning to the end. The purpose of dividing into data segments of equal length is to be able to perform XOR operations on adjacent data segments in a one-to-one correspondence. When the length of the last divided data segment cannot be the same as the length of the previous data segment, the present embodiment fills it with 0 or 1. Afterwards, starting from the header of the data to be encrypted, perform an XOR operation on the first data segment and the second data segment to obtain an XOR result; then starting from the third data segment, perform an XOR operation on the current data segment and the previous XOR result each time to obtain a new XOR result, until the last data segment at the end is calculated to obtain an encryption check code. For example Figure 2 As shown, the hexadecimal data to be encrypted is 7B227265…, a total of 78 bytes. The data segments are divided into one byte length, then the first data segment 7B and the second data segment 22 are XORed, and the result is XORed with the third data segment 72, and the result is XORed with the fourth data segment 65 to obtain the result 4E, and so on, until the result 5A is obtained by XORing with the last byte, 5A is the encryption check code. In this embodiment, the first encryption instruction or the second encryption instruction includes three parts, one part is the original data, another part is the encryption check code, and the last part is the length information of the data. The total data length is 78 plus the length byte used to represent the length information and the byte of the encryption check code, that is, 80 in decimal and 50 in hexadecimal. The final encrypted data is as follows Figure 2 As shown, length information 50 and encryption check code 5A are added to both ends of the original data respectively.
[0053] According to the above-mentioned technical means, an embodiment of the present invention provides a new data encryption method, which divides the original data into segments, and takes the XOR result of the first segment of data and the second segment of data as the basis, performs an XOR operation on the previous XOR result and the next segment of data each time, and then uses the obtained encryption verification code original data to combine into an encryption instruction, so that the confidentiality of the encryption verification code is higher, and because the calculation process does not have complex calculations, the calculation efficiency is high, thereby taking into account the overall efficiency and security of data transmission.
[0054] In some optional implementations, the application end and the cloud can also compress the encrypted data through a compression algorithm to reduce the bandwidth occupied by the data during network transmission, such as GZIP, ZIP and other compression algorithms. This embodiment is only an example and is not limited to this.
[0055] In some optional implementations, the steps of inverse operation of the preset encryption operation performed by the cloud or vehicle in the above steps S103 and S107 include:
[0056] Step b1, verifying the length of the encrypted data according to the length information;
[0057] Step b2: if the length check passes, extract the remaining data after removing the length information and the encryption check code from the encrypted data;
[0058] Step b3, performing a preset encryption operation on the remaining data to obtain a verification code;
[0059] Step b4, comparing the calculation check code and the encryption check code;
[0060] Step b5, if the comparison is consistent, the remaining data is used as the decrypted data, and the decrypted data is the application instruction or the vehicle control instruction;
[0061] Step b6: If the comparison is inconsistent, the message transmission process is terminated.
[0062] Specifically, corresponding to the encryption method of steps a1 to a4, the embodiment of the present invention also provides a method for decrypting and verifying the first encryption instruction / second encryption instruction. When the cloud receives the first encryption instruction or the vehicle receives the second encryption instruction. First, the length of the encrypted data is verified according to the length information written on one end of the encrypted data, and the length of the received encrypted data is calculated to be equal to the length information written on one end. If they are not equal, it means that the received encrypted data has been tampered with, thereby terminating the message transmission process; if the length check passes, the remaining data after the length information and the encryption check code are removed is extracted from the encrypted data. Then, the remaining data is recalculated according to the processing of the aforementioned steps a1 to a3 to obtain the verification code. If the received encrypted data has not been tampered with, the newly calculated verification code should be the same as the encryption check code written on one end of the encrypted data, so that when the verification code and the encryption check code are consistent, the remaining data can be used as the decrypted data, and when the verification code and the encryption check code are inconsistent, the message transmission process is terminated, ensuring the security of the vehicle or the cloud.
[0063] In some optional implementations, the above step S104 includes:
[0064] Step c1, the cloud generates a vehicle control instruction thread based on the application instruction;
[0065] Step c2, storing the vehicle control instruction thread into a thread pool created based on the ring queue;
[0066] Step c3, processing the vehicle control instruction threads in the thread pool in sequence through the circular queue.
[0067] Specifically, after the application instruction data is decrypted and verified through the aforementioned steps, the cloud often needs to parse, convert, and process the application instructions in order to circulate the instructions. The cloud can put the vehicle control instruction threads generated based on the application instructions into the thread pool to process the instruction tasks in sequence, and obtain the vehicle control instructions after the circulation is completed.
[0068] In the related technology, the thread pool processes the vehicle control command threads in sequence according to the queue processing mechanism. Since thread processing often follows the first-in-first-out principle, the vehicle control command thread that enters the thread pool first will be given priority. After processing, the memory address at the head of the thread pool will be idle, and the vehicle control command thread that enters later will still be added to the tail of the thread pool, resulting in two problems. First, it is not known how large the memory address should be allocated to the thread pool, which may occupy too many memory addresses. Second, the idle memory address at the head of the thread pool cannot be effectively utilized.
[0069] In the embodiment of the present invention, Figure 3 As shown, an array with a certain space size is used as the underlying implementation, and a thread pool is created based on a circular queue. The thread pool is equivalent to a circular queue. The queue has two pointers, head pointer head and tail pointer tail. When there is no vehicle control instruction thread in the thread pool, head is equal to tail. The thread pool starts to add vehicle control instruction threads from the head position. Each time a vehicle control instruction thread is added, tail moves back one position. When the array capacity is full, tail goes through a circle and returns to the head position. In order to distinguish the head and tail pointers, it is assumed that the array capacity is 100, and each time a vehicle control instruction thread is added, tail is increased by 1. As threads are continuously added to the thread pool, when tail is equal to 101, it can represent that the thread pool capacity is full. Since the thread pool adheres to the first-in-first-out principle, after the vehicle control instruction thread at the head position is processed, the free memory address starting from the head is looped by tail, and new vehicle control instruction threads can continue to be added. The thread pool provided by the embodiment of the present invention can effectively utilize the free memory address at the head of the thread pool, and can also allocate a fixed-size memory address at the time of initialization, reduce memory occupancy, reduce cloud load, and improve the computing power of the cloud, thereby improving the speed of distributing vehicle control instructions from the cloud to the vehicle end.
[0070] In some optional implementation manners, before the above step S107, the following steps are also included:
[0071] Step d1, the cloud caches the second encryption instruction locally;
[0072] Step d2, when no confirmation information is received from the vehicle end within the preset response timeout period, the cloud end replies with an execution timeout information to the application end, and marks the second encrypted instruction as an instruction that failed to be sent by the cloud end. The confirmation information is used to confirm that the vehicle end has received the second encrypted instruction;
[0073] Step d3, when the cloud detects the online information of the vehicle, it queries whether the vehicle has a failed instruction;
[0074] Step d4, resending the retrieved second encrypted instruction to the vehicle end;
[0075] Step d5, when the confirmation information fed back by the vehicle is received within the preset response timeout period, the cloud responds with a successful execution information to the application.
[0076] Specifically, in the actual application scenarios of the Internet of Vehicles, the instructions cannot be executed due to the instability of the vehicle-side network or the lack of power on the vehicle-side. To solve this problem, an embodiment of the present invention is implemented as follows: the cloud sends the second encrypted instruction to the vehicle-side and caches the second encrypted instruction in a local database, and then waits for a reply from the vehicle-side. If the vehicle-side replies within a short period of time, it means that the instruction is sent successfully, and the cloud replies with a successful execution message to the application side; if the vehicle-side does not feedback confirmation information within a longer preset response timeout period, the vehicle-side is offline. For example, the format of the second encrypted instruction can be {vehicle identification, instruction identification, instruction content, response timeout period}, for example:
[0077] {"reqId":"1696761084077088","cmd":"openAir","temperature":20,"timeout":2000}
[0078] "reqId":"1696761084077088" is the vehicle ID, indicating a unique request for the command; "cmd":"openAir" is the command ID; "temperature":20 is the command content, indicating setting the air conditioner to 20 degrees; and "timeout":2000 indicates a response timeout of 2000 milliseconds.
[0079] Taking setting the air conditioning temperature on the vehicle side as an example, when the vehicle side does not reply with confirmation information within the response timeout period, the cloud side will reply with an execution timeout message to the application side to inform the user, and mark the second encrypted instruction as a failed instruction sent by the cloud side and judge that the vehicle side is offline.
[0080] After that, if the vehicle is started, the vehicle will first establish a session with the cloud through the network. When the cloud detects that the vehicle is online, it will query the cache data based on the vehicle identifier to see if there is an unsuccessful instruction in the current vehicle. If so, it will determine whether the instruction is repeated through reqId. If not, the second encrypted instruction found will be resent to the vehicle through the instruction identifier cmd, for example, telling the vehicle to set the air conditioning temperature to 20 degrees. Finally, the cloud waits for the vehicle to set the air conditioning temperature to 20℃ and waits for feedback confirmation information. When the remote end receives the confirmation information, the cloud server will feedback the successful execution result to the application end.
[0081] The solution provided by the embodiment of the present invention ensures that instructions will not be lost, and the execution and feedback of vehicle control instructions can be completed even when the vehicle is offline. The accuracy of data is guaranteed in the event of an unstable cellular network or even a network outage.
[0082] In some optional implementations, the Apache Flink framework is used for the operation of the database part within the task processing. The Apache Flink framework is a distributed data stream processing framework written in Java and Scala. Any stream data program is executed in a data parallel and pipeline manner. The cloud can execute batch and stream processing programs to process the data, all of which are sent to the framework through the Kafka message queue. Apache Flink performs batch database operations, which can save cloud CPU resources and speed up instruction processing.
[0083] The embodiment of the present invention also provides a method for transmitting messages on an Internet of Vehicles platform. Figure 4 As shown, applied to the application side, the method includes:
[0084] Step S401, generating an application instruction, and performing a preset encryption operation using the numerical values from the beginning to the end of the application instruction to obtain a first encrypted instruction;
[0085] Step S402: Send the first encryption instruction to the cloud.
[0086] Specifically, regarding the message transmission logic of the Internet of Vehicles platform on the application side, reference can be made to the principle explanation based on the Internet of Vehicles platform message transmission system side in the aforementioned method embodiment, which will not be repeated here.
[0087] In some optional implementations, step S401 includes:
[0088] Step e1, dividing the application instruction from the beginning to the end into a plurality of data segments of equal length;
[0089] Step e2, starting from the header of the application instruction, performing an XOR operation using the first data segment and the second data segment to obtain an XOR result;
[0090] Step e3, starting from the third data segment, each time the current data segment is XORed with the previous XOR result to obtain a new XOR result, until the last data segment at the end is calculated to obtain the first encryption check code;
[0091] Step e4, adding the first length information and the first encryption verification code to both ends of the application instruction respectively to obtain the first encrypted instruction, and the first length information is the data length of the first encrypted instruction.
[0092] Specifically, the logic of steps e1 to e4 can be referred to the principle explanation of steps a1 to a4 in the aforementioned method embodiment, which will not be repeated here.
[0093] The embodiment of the present invention also provides a method for transmitting messages on an Internet of Vehicles platform. Figure 5 As shown, the method is applied to the cloud and includes:
[0094] Step S501, receiving a first encrypted instruction sent by an application end, wherein the first encrypted instruction is obtained by the application end by performing a preset encryption operation using the numerical values from the beginning to the end of the application instruction, and the application instruction is an instruction generated by the application end;
[0095] Step S502, decrypting the first encrypted instruction by performing an inverse operation of a preset encryption operation to obtain an application instruction;
[0096] Step S503, generating a vehicle control instruction thread based on the application instruction, and performing instruction flow processing through the vehicle control instruction thread;
[0097] Step S504, performing a preset encryption operation on the transferred vehicle control instruction according to the values from the beginning to the end to obtain a second encrypted instruction;
[0098] Step S505, sending the second encrypted instruction to the vehicle end.
[0099] Specifically, regarding the message transmission logic of the Internet of Vehicles platform on the cloud side, reference can be made to the principle explanation based on the Internet of Vehicles platform message transmission system side in the aforementioned method embodiment, which will not be repeated here.
[0100] In some optional implementations, step S504 includes:
[0101] Step f1, dividing the vehicle control instruction from the beginning to the end into a plurality of data segments of equal length;
[0102] Step f2, starting from the head of the vehicle control instruction, using the first data segment and the second data segment to perform an XOR operation to obtain an XOR result;
[0103] Step f3, starting from the third data segment, each time the current data segment is XORed with the previous XOR result to obtain a new XOR result, until the last data segment at the end is calculated to obtain a second encryption check code;
[0104] Step f4, adding the second length information and the second encryption verification code to both ends of the vehicle control instruction respectively to obtain a second encrypted instruction, where the second length information is the data length of the second encrypted instruction.
[0105] Specifically, the logic of steps f1 to f4 may refer to the principle explanation of steps a1 to a4 in the aforementioned method embodiment, which will not be repeated here.
[0106] In some optional implementations, step S502 includes:
[0107] Step g1, verifying the length of the first encryption instruction according to the first length information at the end of the first encryption instruction, where the first length information is the length of the first encryption instruction counted when the application creates the first encryption instruction;
[0108] Step g2: if the length check passes, remove the first length information and the first encryption check code at both ends of the first encryption instruction to obtain the remaining data, where the first encryption check code is an encryption check code generated when the application end performs a preset encryption operation on the application instruction;
[0109] Step g3, performing a preset encryption operation on the remaining data to obtain a verification code;
[0110] Step g4, comparing the calculation verification code with the first encryption verification code;
[0111] Step g5, if the comparison is consistent, the remaining data is used as the application instruction;
[0112] Step g6: If the comparison is inconsistent, the message transmission process is terminated.
[0113] Specifically, the logic of steps g1 to g6 can be referred to the principle explanation of steps b1 to b6 in the aforementioned method embodiment, which will not be repeated here.
[0114] In some optional implementations, step S503 includes:
[0115] Step h1, generating a vehicle control instruction thread based on the application instruction;
[0116] Step h2, storing the vehicle control instruction thread into a thread pool created based on the ring queue;
[0117] Step h3, process the vehicle control command threads in the thread pool in sequence through the circular queue.
[0118] Specifically, the logic of steps h1 to h3 can be referred to the principle explanation of steps c1 to c3 in the aforementioned method embodiment, which will not be repeated here.
[0119] In some optional implementation manners, after step S505, the method further includes:
[0120] Step i1, caching the second encryption instruction locally;
[0121] Step i2: when no confirmation information is received from the vehicle end within the preset response timeout period, an execution timeout information is replied to the application end, and the second encrypted instruction is marked as an instruction that failed to be sent by the cloud. The confirmation information is used to confirm that the vehicle end has received the second encrypted instruction;
[0122] Step i3, when the online information of the vehicle side is detected, query whether the vehicle side has a failed transmission instruction;
[0123] Step i4, resending the retrieved second encrypted instruction to the vehicle end;
[0124] Step i5, when the confirmation information fed back by the vehicle is received within the preset response timeout period, the execution success information is replied to the application end.
[0125] Specifically, the logic of steps i1 to i5 can be referred to the principle explanation of steps d1 to d5 in the aforementioned method embodiment, which will not be repeated here.
[0126] An embodiment of the present invention also provides a vehicle networking platform message transmission system, including an application end, a cloud end and a vehicle end, wherein the application end and the cloud end are communicatively connected, and the cloud end and the vehicle end are communicatively connected. The vehicle networking platform message transmission system is used to execute the vehicle networking platform message transmission method provided in the aforementioned embodiment.
[0127] like Figure 6 The figure shows the architecture of the message transmission system of the Internet of Vehicles platform. The vehicle side usually refers to the automobile terminal equipment, such as TBOX (Telematics BOX, telematics processing unit), THU (Telematics Head Unit, vehicle controller), etc. The application side refers to the equipment that can issue instructions to the vehicle, such as mobile phone APP, watch APP, other APP, etc. The cloud refers to the server that receives and processes vehicle-side data and application-side data. In this embodiment, the vehicle side and the cloud side, and the cloud side and the application side can communicate directly or based on the distribution server of the MQTT cluster. MQTT is a message queue telemetry transmission, which is a message protocol based on the publish / subscribe paradigm under the ISO standard. Generally speaking, the Internet of Things cards of vehicles are divided into different operators, so Figure 6In the MQTT cluster, two clusters can be deployed according to two operators to receive data from different IoT manufacturers. Each cluster has a receiving service Bridge and a sending service Sender. The receiving service Bridge can use a current limiting algorithm. For example, an initial capacity of 1000 elements is set in the receiving service Bridge, and elements are added to the collection at a constant rate of 100 per second. When the cloud system consumes a request from the Bridge service, it must first obtain an element from the collection. If the element cannot be obtained, the service is rejected, thereby achieving the purpose of current limiting. The cloud and distribution services and various services within the cloud can communicate through message middleware, which is a software architecture pattern for delivering messages in distributed systems. It allows applications to communicate without direct connection by sending messages to the middleware, which then routes the messages to the receiver. Message middleware can provide reliable message delivery, support asynchronous communication and decouple dependencies between applications. For example, common message middleware includes Kafka, RabbitMQ, ActiveMQ, etc. Kafka is a high-throughput distributed publish-subscribe message system, RabbitMQ (RabbitMessage Queu) is an open source message agent software that implements the Advanced Message Queuing Protocol, and ActiveMQ (ActiveMessage Queu) is an open source, message-oriented message agent software that implements the JMS1.1 specification. The specific principle implementation of Kafka, RabbitMQ, and ActiveMQ can refer to the existing technology and will not be repeated here. The cloud server supports the functions of data verification, data storage, and data forwarding to facilitate the execution of the method provided in the aforementioned embodiment.
[0128] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0129] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0130] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for transmitting messages on an Internet of Vehicles platform, characterized in that: Applied to the message transmission system of the Internet of Vehicles platform, the message transmission system of the Internet of Vehicles platform includes an application end, a cloud end and a vehicle end; The application end generates an application instruction, and performs a preset encryption operation using the numerical values from the beginning to the end of the application instruction to obtain a first encrypted instruction; The application sends the first encryption instruction to the cloud; The cloud decrypts the first encrypted instruction by performing an inverse operation of the preset encryption operation to obtain the application instruction; The cloud generates a vehicle control instruction thread based on the application instruction, and performs instruction flow processing through the vehicle control instruction thread; The cloud performs the preset encryption operation on the transferred vehicle control instruction according to the values from the beginning to the end to obtain a second encrypted instruction; The cloud sends the second encrypted instruction to the vehicle end; The vehicle end receives the second encrypted instruction, and decrypts the second encrypted instruction by performing an inverse operation of the preset encryption operation to obtain a vehicle control instruction; The vehicle end executes the vehicle control instruction.
2. The method according to claim 1, characterized in that The step of the application end or the cloud end performing the preset encryption operation includes: Dividing the data to be encrypted into a plurality of data segments of equal length from the beginning to the end, wherein the data to be encrypted is the application instruction or the vehicle control instruction; Starting from the header of the data to be encrypted, performing an XOR operation using the first data segment and the second data segment to obtain an XOR result; Starting from the third data segment, each time the current data segment is XORed with the previous XOR result to obtain a new XOR result, until the last data segment at the end is calculated to obtain the encryption check code; The length information and the encryption check code are respectively added to both ends of the data to be encrypted to obtain encrypted data, wherein the length information is the data length of the encrypted data, and the encrypted data is the first encryption instruction or the second encryption instruction.
3. The method according to claim 2, characterized in that The steps of performing the reverse operation of the preset encryption operation performed by the cloud or the vehicle include: Verifying the length of the encrypted data according to the length information; If the length check passes, extracting the remaining data from the encrypted data without the length information and the encryption check code; Performing the preset encryption operation on the remaining data to obtain a verification code; Comparing the calculation check code with the encryption check code; If the comparison is consistent, the remaining data is used as the decrypted data, and the decrypted data is the application instruction or the vehicle control instruction; If the comparison is inconsistent, the message transmission process will be terminated.
4. The method according to claim 1, characterized in that: The cloud generates a vehicle control instruction thread based on the application instruction, and performs instruction flow processing through the vehicle control instruction thread, including: The cloud generates a vehicle control instruction thread based on the application instruction; Storing the vehicle control instruction thread in a thread pool created based on a circular queue; The vehicle control instruction threads in the thread pool are processed in sequence according to the circular queue.
5. The method according to claim 1, characterized in that Before the vehicle end receives the second encrypted instruction, the method further includes: The cloud caches the second encryption instruction locally; When the confirmation information fed back by the vehicle end is not received within the preset response timeout period, the cloud end replies with an execution timeout information to the application end, and marks the second encrypted instruction as an instruction that failed to be sent by the cloud end, and the confirmation information is used to confirm that the vehicle end has received the second encrypted instruction; When the cloud detects the online information of the vehicle end, querying whether the vehicle end has a failed sending instruction; Resending the retrieved second encrypted instruction to the vehicle end; When the confirmation information fed back by the vehicle end is received within the preset response timeout period, the cloud end replies with an execution success message to the application end.
6. A method for transmitting messages on an Internet of Vehicles platform, characterized in that: Applied to the application side, the method includes: Generate an application instruction, and use the numerical values from the beginning to the end of the application instruction to perform a preset encryption operation to obtain a first encrypted instruction; The first encryption instruction is sent to the cloud.
7. The method according to claim 6, characterized in that The method of performing a preset encryption operation on the values from the beginning to the end of the application instruction to obtain a first encryption instruction includes: Dividing the application instruction from the beginning to the end into a plurality of data segments of equal length; Starting from the header of the application instruction, performing an XOR operation on the first data segment and the second data segment to obtain an XOR result; Starting from the third data segment, each time the current data segment is XORed with the previous XOR result to obtain a new XOR result, until the last data segment at the end is calculated to obtain the first encryption check code; The first length information and the first encryption verification code are respectively added to both ends of the application instruction to obtain a first encrypted instruction, wherein the first length information is the data length of the first encrypted instruction.
8. A method for transmitting messages on an Internet of Vehicles platform, characterized in that: Applied to the cloud, the method includes: Receiving a first encrypted instruction sent by an application end, wherein the first encrypted instruction is obtained by the application end performing a preset encryption operation using numerical values from the beginning to the end of the application instruction, and the application instruction is an instruction generated by the application end; Decrypting the first encrypted instruction by performing an inverse operation of a preset encryption operation to obtain the application instruction; Generate a vehicle control instruction thread based on the application instruction, and perform instruction flow processing through the vehicle control instruction thread; Performing the preset encryption operation on the circulated vehicle control instruction according to the values from the beginning to the end to obtain a second encrypted instruction; The second encrypted instruction is sent to the vehicle end.
9. The method according to claim 8, characterized in that The method of performing the preset encryption operation on the transferred vehicle control instruction according to the values from the beginning to the end to obtain the second encrypted instruction includes: Dividing the vehicle control instruction into a plurality of data segments of equal length from the beginning to the end; Starting from the header of the vehicle control instruction, performing an XOR operation on the first data segment and the second data segment to obtain an XOR result; Starting from the third data segment, each time the current data segment is XORed with the previous XOR result to obtain a new XOR result, until the last data segment at the end is calculated to obtain the second encryption check code; The second length information and the second encryption verification code are respectively added to both ends of the vehicle control instruction to obtain a second encrypted instruction, and the second length information is the data length of the second encrypted instruction.
10. The method according to claim 9, characterized in that The decrypting the first encrypted instruction by performing an inverse operation of a preset encryption operation to obtain an application instruction includes: Verifying the length of the first encrypted instruction according to first length information at the end of the first encrypted instruction, where the first length information is the length of the first encrypted instruction counted when the application end creates the first encrypted instruction; If the length check passes, the first length information and the first encryption check code at both ends of the first encryption instruction are removed to obtain the remaining data, where the first encryption check code is an encryption check code generated when the application end performs the preset encryption operation on the application instruction; Performing the preset encryption operation on the remaining data to obtain a verification code; Comparing the calculation verification code with the first encryption verification code; If the comparison is consistent, the remaining data is used as the application instruction; If the comparison is inconsistent, the message transmission process will be terminated.
11. The method according to claim 8, characterized in that The generating a vehicle control instruction thread based on the application instruction, and performing instruction flow processing through the vehicle control instruction thread, includes: Generate a vehicle control instruction thread based on the application instruction; Storing the vehicle control instruction thread in a thread pool created based on a circular queue; The vehicle control instruction threads in the thread pool are processed in sequence according to the circular queue.
12. The method according to claim 8, characterized in that After sending the second encrypted instruction to the vehicle end, the method further includes: caching the second encryption instruction locally; When no confirmation information fed back by the vehicle end is received within the preset response timeout period, an execution timeout information is replied to the application end, and the second encrypted instruction is marked as an instruction that failed to be sent by the cloud, and the confirmation information is used to confirm that the vehicle end has received the second encrypted instruction; When online information of the vehicle end is detected, querying whether the vehicle end has a failed sending instruction; Resending the retrieved second encrypted instruction to the vehicle end; When the confirmation information fed back by the vehicle end is received within the preset response timeout period, a success message is replied to the application end.
13. A vehicle networking platform message transmission system, characterized in that: It includes an application end, a cloud end and a vehicle end, wherein the application end is communicatively connected to the cloud end, and the cloud end is communicatively connected to the vehicle end.
Citation Information
Cited By
Data processing method, computer equipment, storage medium and program product
CN119918079A
