Dynamic key generation method, upgrade package encryption method, software upgrade method
Encrypting the upgrade package through the dynamic key generation method solves the problem of data tampering in the traditional vehicle software upgrade system, achieving high-security transmission of the upgrade package and safe upgrade of the vehicle software.
Patent Information
- Application Number
- CN202410720762.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-06-05
AI Technical Summary
The traditional vehicle software upgrade system lacks security encryption measures, which makes the upgrade package data easily tampered with and affects vehicle safety.
The dynamic key generation method is used to generate encryption preprocessing values through new energy vehicle data, vehicle owner parameter data, communication end address security information, communication time and communication address, and combines the MD5 algorithm and XOR operation to generate a dynamic key for encryption and Decrypt the upgrade package to ensure the security of data transmission.
It effectively prevents tampering of the upgrade package during transmission, improves the security and real-time nature of vehicle software upgrades, and ensures data integrity and confidentiality.
Smart Images

Figure CN118316604B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of Internet of Things, and in particular to a dynamic key generation method, an upgrade package encryption method, a software upgrade method, a software upgrade system and a communication device. Background Art
[0002] In the traditional vehicle operation and maintenance method, operation and maintenance personnel are required to use special equipment on site to update the vehicle's software, which results in high upgrade costs and poor user experience. Common upgrade systems lack security encryption measures during use, which causes the upgrade package data to be tampered with during the upgrade process, thus affecting the safety of the vehicle. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a software upgrade method and a software upgrade system, a server and a vehicle, which can effectively prevent the upgrade packages and other data used by the vehicle during the software upgrade process from being tampered with, thereby affecting the safety of the vehicle.
[0004] In a first aspect, an embodiment of the present application provides a method for generating a dynamic key, comprising:
[0005] Generate an identity parameter matrix based on new energy vehicle data and vehicle owner parameter data;
[0006] Performing nonlinear processing on the identity parameter matrix according to the communication terminal address security information;
[0007] Generate a communication matrix according to the communication time and the communication address, and perform nonlinear processing on the communication matrix;
[0008] Obtaining encryption preprocessing values according to the identity parameter matrix after nonlinear processing and the communication matrix after nonlinear processing;
[0009] A dynamic key is generated according to the encryption preprocessing value.
[0010] In the above implementation process, the identity parameter matrix is nonlinearly processed according to the communication end address security information; the communication matrix is generated according to the communication time and the communication address, and the communication matrix is nonlinearly processed; the encryption preprocessing value is obtained according to the identity parameter matrix after nonlinear processing and the communication matrix after nonlinear processing, and the dynamic key is generated according to the encryption preprocessing value. Since the encryption preprocessing value is generated by using multiple data and nonlinear processing methods, and the dynamic key is generated based on the encryption preprocessing value, the dynamic key has higher security and real-time performance.
[0011] Further, the generating a dynamic key according to the encryption preprocessing value includes:
[0012] Filling the encryption preprocessing value to obtain a filled encryption preprocessing value;
[0013] Generate a first sub-encryption preprocessing value and a second sub-encryption preprocessing value according to the padded encryption preprocessing value;
[0014] Processing the encryption preprocessing value according to the current communication timing information to obtain a third sub-encryption preprocessing value;
[0015] Processing the first sub-encryption preprocessing value and the third sub-encryption preprocessing value by using an MD5 algorithm to generate a first hash value;
[0016] The dynamic key is generated according to the first hash value and the second sub-encrypted pre-processed value.
[0017] In the above implementation process, the encryption preprocessing value is filled to obtain the first sub-encryption preprocessing value and the second sub-encryption preprocessing value, the encryption preprocessing value is processed according to the communication timing information to obtain the third sub-encryption preprocessing value, the first hash value is generated according to the first sub-encryption preprocessing value, the third sub-encryption preprocessing value and the MD5 algorithm; the dynamic key is generated according to the first hash value and the second sub-encryption preprocessing value. The communication timing information is integrated into the dynamic key generation process, so that the security of the dynamic key is further improved.
[0018] Further, the generating a first sub-encryption preprocessing value and a second sub-encryption preprocessing value according to the padded encryption preprocessing value includes:
[0019] Performing an XOR calculation on the padded encryption preprocessing value and the first preset value to obtain the first sub-encryption preprocessing value;
[0020] The padded encryption preprocessing value and the second preset value are XOR-ed to obtain the second sub-encryption preprocessing value.
[0021] In the above implementation process, the encryption preprocessing value is filled and different preset values are used to perform XOR calculation with the encryption preprocessing value to obtain the first sub-encryption preprocessing value and the second sub-encryption preprocessing value, thereby further improving the security of the dynamic key.
[0022] Further, the processing of the encryption preprocessing value according to the current communication timing information to obtain a third sub-encryption preprocessing value includes:
[0023] The encryption preprocessing value is processed according to the number of communications to obtain the third sub-encryption preprocessing value.
[0024] In the above implementation process, the third encryption preprocessing value incorporates the number of communications, so that the third encryption preprocessing value has higher security.
[0025] In a second aspect, an embodiment of the present application provides an upgrade package encryption method, the method comprising: generating a first dynamic key and a first encryption preprocessing value according to the dynamic key generation method described in any one of the first aspects;
[0026] Encrypting the upgrade package according to the first dynamic key and the first encryption pre-processing value to obtain a first encrypted upgrade package;
[0027] Adding the first encryption preprocessing value to the first encryption upgrade package to obtain a second encryption upgrade package;
[0028] The second encrypted upgrade package is sent to a recipient, so that the recipient generates a second dynamic key and a second encryption preprocessing value according to the dynamic key generation method described in any one of the first aspects, and decrypts the first encrypted upgrade package according to the second dynamic key and the second encryption preprocessing value to obtain a decrypted upgrade package; the integrity of the decrypted upgrade package is verified according to the second dynamic key, and if the verification is successful, the upgrade operation is performed according to the decrypted upgrade package.
[0029] In the above implementation process, multiple encryption algorithms and multiple data are integrated into the generation process of dynamic keys, and the data is related to identity information and communication information. Therefore, the upgraded encrypted upgrade package has a high degree of security. The encrypted pre-processing value generated during the dynamic key upgrade process has a high degree of randomness and confidentiality. The upgrade package is verified by the encrypted pre-processing value, which can prevent the upgrade package from being modified during transmission.
[0030] In a third aspect, an embodiment of the present application provides an upgrade package decryption method, which is applied to a receiving party, and the method includes: obtaining a second encrypted upgrade package sent by a sender, and obtaining a first encrypted upgrade package and a first encrypted preprocessing value according to the second encrypted upgrade package;
[0031] Generate a second dynamic key and a second encryption preprocessing value according to the dynamic key generation method according to any one of the first aspects;
[0032] Decrypting the first encrypted upgrade package according to the second dynamic key and the second encryption pre-processing value to obtain a decrypted upgrade package;
[0033] The integrity of the decrypted upgrade package is verified according to the second dynamic key, and if the verification is successful, an upgrade operation is performed according to the decrypted upgrade package.
[0034] In the above implementation process, multiple encryption algorithms and multiple data are integrated into the generation process of dynamic keys, and the data is related to identity information and communication information. Therefore, the upgraded encrypted upgrade package has a high degree of security. The encrypted pre-processing value generated during the dynamic key upgrade process has a high degree of randomness and confidentiality. The upgrade package is verified by the encrypted pre-processing value, which can prevent the upgrade package from being modified during transmission.
[0035] Further, the receiving party includes: a communication module and a terminal;
[0036] The communication module and the terminal perform two-way authentication under preset conditions;
[0037] After the two-way authentication succeeds, the terminal obtains the second encrypted upgrade package sent by the sender through the communication module.
[0038] In the above implementation process, the security of internal data transmission of the receiver is achieved through security authentication, which further effectively ensures the security of the upgrade package during the upgrade.
[0039] Further, performing the upgrade operation according to the decrypted upgrade package includes:
[0040] Sending the decrypted upgrade package to a test node so that the test node performs a simulated upgrade to obtain a test result;
[0041] The test result sent by the test node is obtained, and an upgrade operation is performed according to the test result and the decrypted upgrade package.
[0042] In the above implementation process, a simulated upgrade is performed in advance through the test node, and a decision is made whether to upgrade the vehicle software based on the test results returned by the test node to avoid vehicle unavailability due to upgrade failure.
[0043] Furthermore, the communication module and the terminal perform two-way authentication by the following method:
[0044] After the communication module and the terminal establish a connection, the communication module generates a time random number, generates a first verification key based on the time random number and a first preset algorithm, and sends the time random number to the terminal;
[0045] After receiving the time random number, the terminal generates a second verification key based on the time random number and the first preset algorithm;
[0046] The terminal generates a first challenge code based on the current time, and generates first integrated verification information according to the first challenge code and the terminal verification information;
[0047] The terminal generates a first identity authentication information ciphertext from the first integrated verification information according to the second verification key and the second preset algorithm;
[0048] The terminal generates a first identity verification information digest of the first integrated verification information according to the first challenge code and an information digest algorithm;
[0049] The terminal sends the first identity authentication information ciphertext and the first identity authentication information digest to the communication module;
[0050] The communication module obtains a second challenge code and a second integrated verification information according to the first verification key, the first identity verification information ciphertext and the second preset algorithm;
[0051] The communication module generates a second identity verification information digest of the second integrated verification information according to the second challenge code and the information digest algorithm;
[0052] The communication module compares the first identity authentication information digest with the second identity authentication information digest. If they are consistent, the communication module confirms that the terminal has been authenticated and sends the second challenge code to the terminal.
[0053] The terminal compares the first challenge code with the second challenge code, and if they are consistent, the terminal confirms that the communication module verification has passed.
[0054] In the above implementation process, two-way authentication between the vehicle gateway and the vehicle terminal is completed based on random numbers, challenge codes and multiple algorithms, effectively ensuring the security of data during vehicle software upgrades.
[0055] In a fourth aspect, an embodiment of the present application provides a software upgrade method, which is applied to a software upgrade system, wherein the software upgrade system at least includes: a sender and a receiver; the method includes: the sender generates a first dynamic key and a first encryption preprocessing value according to the dynamic key generation method described in any one of the first aspects;
[0056] The sender encrypts the upgrade package according to the first dynamic key and the first encryption pre-processing value to obtain a first encrypted upgrade package;
[0057] The sender adds the first encryption preprocessing value to the first encryption upgrade package to obtain a second encryption upgrade package;
[0058] The sender sends the second encrypted upgrade package to the receiver;
[0059] The receiver obtains the second encrypted upgrade package sent by the sender, and obtains the first encrypted upgrade package and the first encrypted pre-processing value according to the second encrypted upgrade package;
[0060] The receiving party generates a second dynamic key and a second encryption preprocessing value according to the dynamic key generation method according to any one of the first aspects;
[0061] The receiver decrypts the upgrade package according to the second dynamic key and the second encryption pre-processing value to obtain a decrypted upgrade package;
[0062] The receiver verifies the integrity of the decrypted upgrade package according to the second dynamic key, and when the verification passes, performs an upgrade operation according to the decrypted upgrade package.
[0063] In a fifth aspect, an embodiment of the present application provides a software upgrade system, the software upgrade system comprising: a sender and a receiver;
[0064] The sender is used to generate a first dynamic key and a first encryption preprocessing value according to the dynamic key generation method described in any one of the first aspects; encrypt the upgrade package according to the first dynamic key and the first encryption preprocessing value to obtain a first encrypted upgrade package; add the first encryption preprocessing value to the first encrypted upgrade package to obtain a second encrypted upgrade package; and send the second encrypted upgrade package to the receiver;
[0065] The sender is used to obtain a second encrypted upgrade package sent by the sender, and obtain the first encrypted upgrade package and the first encrypted preprocessing value according to the second encrypted upgrade package; generate a second dynamic key and a second encrypted preprocessing value according to the dynamic key generation method described in any one of the first aspects; decrypt the first encrypted upgrade package according to the second dynamic key and the second encrypted preprocessing value to obtain a decrypted upgrade package; verify the integrity of the decrypted upgrade package according to the second dynamic key, and when the verification is successful, perform an upgrade operation according to the decrypted upgrade package.
[0066] In a sixth aspect, an embodiment of the present application provides a communication device for executing the method described in any one of the first aspect, the second aspect and the third aspect.
[0067] Other features and advantages disclosed in the present application will be described in the following description, or some features and advantages can be inferred or determined without doubt from the description, or can be learned by implementing the above-mentioned technology disclosed in the present application.
[0068] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0070] Figure 1 A schematic diagram of a flow chart of a dynamic key generation method provided in an embodiment of the present application;
[0071] Figure 2 A flowchart of the upgrade package encryption method provided in an embodiment of the present application;
[0072] Figure 3 A flowchart of the upgrade package decryption method provided in an embodiment of the present application;
[0073] Figure 4 A schematic diagram of a two-way authentication method according to an embodiment of the present invention;
[0074] Figure 5 A flowchart of a software upgrade method provided in an embodiment of the present application;
[0075] Figure 6 A schematic diagram of the structure of the software upgrade system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0076] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0077] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0078] Example 1
[0079] See also Figure 1 The embodiment of the present application provides a dynamic key generation method, which is applied to an encryption controller, a cloud server, a local server, a vehicle terminal or a network device, and the method includes:
[0080] S11: Generate an identity parameter matrix according to the new energy vehicle data and the owner parameter data;
[0081] S12: performing nonlinear processing on the identity parameter matrix according to the communication end address security information;
[0082] S13: Generate a communication matrix according to the communication time and the communication address, and perform nonlinear processing on the communication matrix;
[0083] S14: Obtaining encryption preprocessing values according to the identity parameter matrix after nonlinear processing and the communication matrix after nonlinear processing;
[0084] S15: Generate a dynamic key according to the encryption preprocessing value.
[0085] In the above embodiment, in S11, the car data may include: the overall model of the vehicle, the part model and other data, and the owner parameter data may be name, gender, ID number, etc.; it is understandable that the first signature value of the upgrade package corresponding to different owners and different vehicles is generally different. In S12, nonlinear processing can be performed through the S box, which is the basic structure used to perform permutation calculations in cryptography, especially in block cipher algorithms, it is the only nonlinear structure. The main function of the S box is to perform a simple "replacement" operation on the input data, that is, to map a certain length of input (usually multiple bits) to a shorter output (usually one byte or less). This mapping relationship is nonlinear, which means that a slight change in the input bit may cause a significant change in the output bit, thereby enhancing the security of the cryptographic system; the communication address security information includes: the address encryption rules between the cloud server and the local server / vehicle, the IP address of the cloud server, the IP address of the local server and the IP address of the vehicle, etc. The communication time can be the current time, and the communication address can be the IP address of the two communicating parties.
[0086] The identity parameter matrix is data in the form of a matrix of identity parameters, and the communication matrix is data in the form of a matrix of communication time and communication address. For example, elements at different positions in the identity parameter matrix represent different identity parameters, and the identity parameters at least include: new energy vehicle data and owner parameter data. In the communication matrix, elements at different positions represent different communication information, and the communication information at least includes: communication time and communication address.
[0087] In the above implementation process, the identity parameter matrix is processed nonlinearly according to the communication end address security information; the communication matrix is generated according to the communication time and the communication address, and the communication matrix is processed nonlinearly; the encryption preprocessing value is obtained according to the identity parameter matrix after nonlinear processing and the communication matrix after nonlinear processing, and the dynamic key is generated according to the encryption preprocessing value. Since the encryption preprocessing value is generated by using multiple data and nonlinear processing methods, and the dynamic key is generated based on the encryption preprocessing value, the dynamic key has higher security and real-time performance.
[0088] In some embodiments, generating a dynamic key according to the encrypted pre-processed value S15 includes:
[0089] Fill the encryption preprocessing value to obtain the filled encryption preprocessing value; generate a first sub-encryption preprocessing value and a second sub-encryption preprocessing value according to the filled encryption preprocessing value; process the encryption preprocessing value according to the current communication timing information to obtain a third sub-encryption preprocessing value; process the first sub-encryption preprocessing value and the third sub-encryption preprocessing value through the MD5 algorithm to generate a first hash value; generate a dynamic key according to the first hash value and the second sub-encryption preprocessing value.
[0090] Exemplarily, the length of the encryption preprocessing value is 16 bytes, and the encryption preprocessing value is padded to make its length 64 bytes.
[0091] In some embodiments, the first hash value is obtained according to the following formula:
[0092] H=MD5(PRES0||PREN);
[0093] Among them, H is the first hash value, PRES0 is the first sub-encryption preprocessing value, PREN is the third sub-encryption preprocessing value, and || is a string concatenation operator.
[0094] In some embodiments, the dynamic key is generated according to the following formula:
[0095] DKEY=MD5(PRES1||H);
[0096] DKEY is the dynamic key, and PRES1 is the second sub-encryption pre-processing value.
[0097] In some embodiments, the dynamic key may be obtained by the following formula:
[0098] .
[0099] In the above implementation process, the encryption preprocessing value is filled to obtain the first sub-encryption preprocessing value and the second sub-encryption preprocessing value, the encryption preprocessing value is processed according to the communication timing information to obtain the third sub-encryption preprocessing value, the first hash value is generated according to the first sub-encryption preprocessing value, the third sub-encryption preprocessing value and the MD5 algorithm; the dynamic key is generated according to the first hash value and the second sub-encryption preprocessing value. The communication timing information is integrated into the dynamic key generation process, so that the security of the dynamic key is further improved.
[0100] Generate a first sub-encryption preprocessing value and a second sub-encryption preprocessing value according to the padded encryption preprocessing value, including: performing an XOR calculation on the padded encryption preprocessing value and the first preset value to obtain the first sub-encryption preprocessing value; and performing an XOR calculation on the padded encryption preprocessing value and the second preset value to obtain the second sub-encryption preprocessing value.
[0101] Exemplarily, the first preset value is 0x363636…, the second preset value is 05C5C5C…, and the first encryption preprocessing value and the second encryption preprocessing value are obtained by the following formula:
[0102] ;
[0103] In the formula, the ⊕ operator is an exclusive OR calculation;
[0104] Among them, PRES0 is the first encryption preprocessing value, PRES1 is the second encryption preprocessing value, and the ⊕ operator is an exclusive OR calculation.
[0105] In the above implementation process, the encryption preprocessing value is filled and different preset values are used to perform XOR calculation with the encryption preprocessing value to obtain the first sub-encryption preprocessing value and the second sub-encryption preprocessing value, thereby further improving the security of the dynamic key.
[0106] In some embodiments, the encryption preprocessing value is processed according to the current communication timing information to obtain the third sub-encryption preprocessing value, including: the encryption preprocessing value is processed according to the number of communications to obtain the third sub-encryption preprocessing value.
[0107] In the embodiment of the present application, the number of communications depends on the communicating parties, which may be: the sender is the encryption controller and the cloud server, the cloud server and the local server, or the local server and the vehicle.
[0108] In some embodiments, the third encryption pre-processing value may be obtained by the following formula:
[0109] ;
[0110] in, is the third sub-encryption preprocessing value, and n is the number of communications between the two parties currently communicating.
[0111] In the above implementation process, the third encryption preprocessing value incorporates the number of communications, so that the third encryption preprocessing value has higher security.
[0112] Example 2
[0113] See also Figure 2 , the embodiment of the present application provides a software upgrade method, comprising:
[0114] S21: Generate a first dynamic key and a first encryption preprocessing value according to the dynamic key generation method of any one of Embodiment 1;
[0115] S22: Encrypt the upgrade package according to the first dynamic key and the first encryption pre-processing value to obtain a first encrypted upgrade package;
[0116] Exemplarily, the first dynamic key and the first encryption pre-processing value are used as input values of a preset encryption algorithm to encrypt the upgrade package. In some embodiments, the encryption algorithm may be an Advanced Encryption Standard (AES) algorithm.
[0117] S23: adding the first encryption preprocessing value to the first encryption upgrade package to obtain a second encryption upgrade package;
[0118] S24: Send the second encrypted upgrade package to the recipient, so that the recipient generates a second dynamic key and a second encryption preprocessing value according to the dynamic key generation method of Example 1, decrypts the first encrypted upgrade package according to the second dynamic key and the second encryption preprocessing value to obtain a decrypted upgrade package; verifies the integrity of the decrypted upgrade package according to the second dynamic key, and if the verification is successful, performs the upgrade operation according to the decrypted upgrade package.
[0119] In some embodiments, the sender may be an encryption controller for encryption, and the receiver may be a cloud server.
[0120] In some embodiments, the sender may be a cloud server and the receiver may be a vehicle.
[0121] In some embodiments, the sender may be a cloud server and the receiver may be a vehicle.
[0122] In the above implementation process, multiple encryption algorithms and multiple data are integrated into the generation process of dynamic keys, and the data is related to identity information and communication information. Therefore, the upgraded encrypted upgrade package has a high degree of security. The encrypted pre-processing value generated during the dynamic key upgrade process has a high degree of randomness and confidentiality. The upgrade package is verified by the encrypted pre-processing value, which can prevent the upgrade package from being modified during transmission.
[0123] Example 3
[0124] See also Figure 3 , the embodiment of the present application provides an upgrade package decryption method, which is applied to a receiving party, and the method includes:
[0125] S31: Obtain a second encrypted upgrade package sent by a sender, and obtain a first encrypted upgrade package and a first encrypted pre-processing value according to the second encrypted upgrade package;
[0126] It is understandable that if the information of the receiver and the sender is not modified during the transmission process, the first encryption upgrade package and the first encryption preprocessing value in S31 are the same as the first encryption upgrade package and the first encryption preprocessing value in Example 2.
[0127] S32: Generate a second dynamic key and a second encryption preprocessing value according to the dynamic key generation method of any one of Embodiment 1;
[0128] S33: decrypting the first encrypted upgrade package according to the second dynamic key and the second encryption pre-processing value to obtain a decrypted upgrade package;
[0129] S34: Verify the integrity of the decrypted upgrade package according to the second dynamic key. If the verification is successful, perform the upgrade operation according to the decrypted upgrade package.
[0130] It is understandable that if the information of the receiver and the sender is not modified during the transmission process, the second dynamic key in S24 is the same as the first dynamic key in Example 3, and the second encryption preprocessing value is the same as the first encryption preprocessing value in Example 2. The encrypted second upgrade package is the same as the upgrade package in Example 2.
[0131] If the first dynamic key and the second dynamic key are the same, it is confirmed that the upgrade package is complete.
[0132] In some embodiments, the second dynamic key and the second encryption preprocessing value are used as input values of a decryption algorithm corresponding to a preset encryption algorithm to achieve decryption of the upgrade package. In some embodiments, the encryption algorithm may be an Advanced Encryption Standard (AES) algorithm.
[0133] In the above implementation process, multiple encryption algorithms and multiple data are integrated into the generation process of dynamic keys, and the data is related to identity information and communication information. Therefore, the upgraded encrypted upgrade package has a high degree of security. The encrypted pre-processing value generated during the dynamic key upgrade process has a high degree of randomness and confidentiality. The upgrade package is verified by the encrypted pre-processing value, which can prevent the upgrade package from being modified during transmission.
[0134] In this application, the two parties in communication include: a sender and a receiver. In some embodiments, the sender is an encryption controller and the receiver is a cloud server. In some embodiments, the sender is a cloud server and the receiver is a local server. In some embodiments, the sender is a local server and the receiver is a vehicle.
[0135] In some embodiments, if the recipient is a cloud server, performing an upgrade operation based on the decrypted upgrade package includes: encrypting the upgrade package according to S21~S23 and sending it to a local server, wherein the sender is a cloud server and the recipient is a local server.
[0136] In some embodiments, if the recipient is a local server, performing an upgrade operation according to the decrypted upgrade package includes: encrypting the upgrade package and sending it to the vehicle according to S21 to S23, wherein the sender is the local server and the recipient is the vehicle.
[0137] In some embodiments, if the recipient is a vehicle, performing an upgrade operation according to the decrypted upgrade package includes: upgrading the vehicle software according to the upgrade package.
[0138] In some embodiments, when the recipient is a vehicle and the sender is a local server, obtaining the second encrypted upgrade package sent by the sender includes:
[0139] The vehicle's terminal runs the upgrade program at a fixed cycle. When a new version of the software is detected on the local server, the terminal automatically pops up the upgrade interface for the user to operate. When the terminal receives the instruction to confirm the OTA upgrade of the new energy vehicle, it automatically downloads the upgrade file. After the upgrade file is downloaded to the on-board terminal, the terminal verifies the version and integrity of the upgrade program, and determines whether the current status of the vehicle meets the upgrade conditions. After the upgrade is completed, the terminal automatically restarts, completes the software version update, and uploads the upgrade log to the local server or enterprise cloud.
[0140] In some embodiments, the receiving party includes: a communication module and a terminal, a communication module and a terminal; the communication module and the terminal perform two-way authentication under preset conditions; after the two-way authentication is successful, the terminal obtains the second encrypted upgrade package sent by the sender through the communication module.
[0141] In some embodiments, the preset condition may be that the vehicle is powered on.
[0142] See also Figure 4 In some embodiments, the communication module and the terminal perform two-way authentication by the following method:
[0143] S41: After the communication module and the terminal are connected, the communication module generates a time random number, generates a first verification key based on the time random number and a first preset algorithm, and sends the time random number to the terminal;
[0144] In some embodiments, the first preset algorithm may be a symmetric encryption algorithm or an asymmetric encryption algorithm, etc.
[0145] S42: After receiving the time random number, the terminal generates a second verification key based on the time random number and the first preset algorithm;
[0146] S43: The terminal generates a first challenge code based on the current time, and generates first integrated verification information according to the first challenge code and the terminal verification information;
[0147] In some embodiments, the challenge code and the terminal verification information may be concatenated to obtain integrated verification information.
[0148] S44: The terminal generates a first identity authentication information ciphertext from the first integrated verification information according to the second verification key and the second preset algorithm;
[0149] In some embodiments, the second preset algorithm may be an AES-128 algorithm.
[0150] The second verification key is used as the encryption key of the AES-128 algorithm, and the first integrated verification information is used to generate the first identity authentication information ciphertext.
[0151] S45: The terminal generates a first identity verification information digest of the first integrated verification information according to the first challenge code and the information digest algorithm;
[0152] In some embodiments, the formula corresponding to the message digest algorithm is as follows:
[0153] ;
[0154] in, is the authentication information summary, is the challenge code after padding (can be 64 bytes), is the exclusive OR operator, Obtained by the following formula:
[0155] ;
[0156] in, is the number of communications between the communication module and the terminal;
[0157] In the embodiment of the present application, the filling method is to add 0 on the left.
[0158] S46: The terminal sends the first identity authentication information ciphertext and the first identity authentication information digest to the communication module;
[0159] S47: The communication module obtains a second challenge code and a second integrated verification information according to the first verification key, the first identity verification information ciphertext and the second preset algorithm;
[0160] S48: The communication module generates a second identity verification information digest of the second integrated verification information according to the second challenge code and the information digest algorithm;
[0161] S49: The communication module compares the first identity authentication information digest with the second identity authentication information digest. If they are consistent, the communication module confirms that the terminal verification is successful and sends the second challenge code to the terminal;
[0162] S410: The terminal compares the first challenge code with the second challenge code. If they are consistent, the terminal confirms that the communication module verification is successful.
[0163] In the above implementation process, two-way authentication between the vehicle gateway and the vehicle terminal is completed based on random numbers, challenge codes and multiple algorithms, effectively ensuring the security of data during vehicle software upgrades.
[0164] In some embodiments, when the recipient is a vehicle, the second encrypted upgrade package is a second encrypted upgrade package in ciphertext form encrypted by the local server using a symmetric key;
[0165] Upgrading vehicle software according to the upgrade package includes: obtaining a second encrypted upgrade package in ciphertext form sent by a sender, including: obtaining a symmetric key, decrypting the second encrypted upgrade package in ciphertext form according to the symmetric key, and obtaining a second encrypted upgrade package.
[0166] The method for obtaining a symmetric key includes: obtaining the symmetric key encrypted by a public key, and decrypting the encrypted symmetric key according to a pre-stored private key to obtain the symmetric key.
[0167] The symmetric key generation method is as follows: the receiver generates a symmetric key (usually a randomly generated key). This symmetric key will be used to encrypt data, and the sender will use the receiver's public key (or the public key of a public encryption server) to encrypt the symmetric key. This process ensures that only the receiver with the corresponding private key can decrypt the symmetric key.
[0168] Secure transmission of encrypted symmetric key: The encrypted symmetric key is securely transmitted to the recipient. Since the symmetric key is encrypted, even if a man-in-the-middle attacker intercepts the key, they cannot decrypt and use it unless they have access to the private key. Decryption by the recipient using the private key: The recipient uses their private key to decrypt the received encrypted symmetric key. Once the symmetric key is decrypted, the recipient can use this key to decrypt the received data.
[0169] In some embodiments, upgrading the vehicle software according to the upgrade package further includes:
[0170] Verify the certificates of the local server and / or cloud service. If the verification passes, upgrade the vehicle software according to the upgrade package.
[0171] In some embodiments, performing an upgrade operation according to the decrypted upgrade package includes:
[0172] The decrypted upgrade package is sent to the test node so that the test node performs a simulated upgrade to obtain a test result; the test result sent by the test node is obtained, and an upgrade operation is performed according to the test result and the decrypted upgrade package.
[0173] The test nodes include: master node and slave node. The master node can be a vehicle terminal and the slave node can be a local server. The process of setting up the test node is as follows:
[0174] 1. Preparation phase Environment construction: Ensure that the terminal software and slave node hardware platform are compatible, and have the necessary programming environment and development tools. Firmware version management: Establish a firmware version control system to record different versions of firmware and their update logs. Network connection: Ensure that there is a stable network connection between the terminal and the slave node, which may be Wi-Fi, Bluetooth, serial port, Ethernet, etc. 2. Protocol design Define communication protocol: Design a communication protocol for data exchange between the terminal and the slave node. The protocol should at least include data format, command set, error handling mechanism, etc. Encryption and security: In order to ensure the security of data transmission, the protocol should include data encryption and authentication mechanisms. 3. Upgrade process design Discover slave nodes: The terminal software discovers upgradeable slave nodes through network scanning or existing lists. Establish connection: The terminal software establishes a protocol-based connection with the slave node. Version check: Exchange data through the protocol to check the current firmware version of the slave node and the version to be updated. Permission verification: Ensure that only authorized terminal software can perform upgrade operations. Data transmission: According to the protocol, the terminal sends the data of the new firmware to the slave node. The data may need to be transmitted in segments and contain verification information to ensure integrity. Firmware application: After receiving the data from the slave node, it will be verified and the new firmware will be applied after verification. Confirmation and testing: After the upgrade is completed, the slave node should send a confirmation message to the terminal. The terminal can send a test command to verify whether the slave node is operating normally. 4. Implementation and testing of terminal software development: The terminal software development is completed according to the design and unit testing is performed. Test in simulation environment: Test the entire upgrade process in a simulation environment without actual slave nodes to ensure that there are no design errors. Actual test: Test on the actual slave node to ensure that the upgrade process can work properly under real conditions. 5. Monitoring and logging Logging: Ensure that there are detailed log records during the upgrade process to facilitate troubleshooting and analysis. Monitor system status: Monitor the system status of the slave node during the upgrade process to ensure its normal operation. 6. Security and rollback mechanism Security measures: Design necessary security measures, such as firmware signature verification, error detection during the upgrade process, etc. Rollback mechanism: If the upgrade fails, ensure that there is a reliable rollback mechanism so that the slave node can be restored to the state before the upgrade.
[0175] In the above implementation process, a simulated upgrade is performed in advance through the test node, and a decision is made whether to upgrade the vehicle software based on the test results returned by the test node to avoid vehicle unavailability due to upgrade failure.
[0176] Example 4
[0177] See also Figure 5The embodiment of the present application also provides a communication method, which is applied to a software upgrade system. The software upgrade system at least includes: a sender and a receiver; the method includes:
[0178] S51: The sender generates a first dynamic key and a first encryption preprocessing value according to any dynamic key generation method of Embodiment 1;
[0179] S52: The sender encrypts the upgrade package according to the first dynamic key and the first encryption pre-processing value to obtain a first encrypted upgrade package;
[0180] S53: The sender adds the first encryption preprocessing value to the first encryption upgrade package to obtain a second encryption upgrade package;
[0181] S54: The sender sends the second encrypted upgrade package to the receiver;
[0182] S55: The receiver obtains the second encrypted upgrade package sent by the sender, and obtains the first encrypted upgrade package and the first encrypted pre-processing value according to the second encrypted upgrade package;
[0183] S56: The receiver generates a second dynamic key and a second encryption preprocessing value according to the dynamic key generation method of any one of Embodiment 1;
[0184] S57: The receiver decrypts the first encrypted upgrade package according to the second dynamic key and the second encryption pre-processing value to obtain a decrypted upgrade package;
[0185] S58: The receiver verifies the integrity of the decrypted upgrade package according to the second dynamic key, and when the verification passes, performs the upgrade operation according to the decrypted upgrade package.
[0186] The specific implementation of the above steps may be the same as that of Examples 1-3, and will not be repeated here.
[0187] In some embodiments, the software system includes: a first sender, a first receiver, a second sender, and a second receiver; wherein the first sender is a cloud server, the first receiver and the second sender are local servers, and the second receiver is a vehicle. wherein the first sender and the first receiver communicate in S51-S59 mode, and the second sender and the second receiver communicate in S51-S59 mode.
[0188] Example 5
[0189] See also Figure 6 ,The embodiment of the present application also provides a software system, the software upgrade system includes: a sender and a receiver;
[0190] The sender is used to generate a first dynamic key and a first encryption preprocessing value according to the dynamic key generation method of any one of the embodiments 1; encrypt the upgrade package according to the first dynamic key and the first encryption preprocessing value to obtain a first encrypted upgrade package; add the first encryption preprocessing value to the first encrypted upgrade package to obtain a second encrypted upgrade package; and send the second encrypted upgrade package to the receiver;
[0191] The sender is used to obtain a second encrypted upgrade package sent by the sender, and obtain the first encrypted upgrade package and the first encrypted preprocessing value according to the second encrypted upgrade package; generate a second dynamic key and a second encrypted preprocessing value according to the dynamic key generation method of any one of Example 1; decrypt the first encrypted upgrade package according to the second dynamic key and the second encrypted preprocessing value to obtain a decrypted upgrade package; verify the integrity of the decrypted upgrade package according to the second dynamic key, and when the verification is successful, perform the upgrade operation according to the decrypted upgrade package.
[0192] In some embodiments, the software upgrade system includes: a first sender, a first receiver, a second sender, and a second receiver; wherein the first sender is a cloud server, the first receiver and the second sender are local servers, and the second receiver is a vehicle. The first sender and the first receiver are used for the steps corresponding to S51-S59, and the second sender and the second receiver are used for the methods corresponding to S51-S59.
[0193] It should be noted that, in the absence of any contradiction, the embodiments and implementation methods of the present application can be arbitrarily combined to form new embodiments or new implementation methods.
[0194] In some embodiments, the software system upgrade system may further include: a power supply module for supplying power, a communication module for communication, a test node for testing, and the like.
[0195] The embodiment of the present application also provides a computer program product for executing the method of the above method embodiment.
[0196] An embodiment of the present application also provides a communication device for executing any method of embodiments 1-4.
[0197] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0198] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0199] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.
[0200] The above description is only an embodiment of the present application and is not intended to limit the scope of protection of the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.
[0201] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0202] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
Claims
1. A method for generating a dynamic key, characterized in that: include: Generate an identity parameter matrix based on new energy vehicle data and vehicle owner parameter data; Performing nonlinear processing on the identity parameter matrix according to the communication terminal address security information; Generate a communication matrix according to the communication time and the communication address, and perform nonlinear processing on the communication matrix; Obtaining encryption preprocessing values according to the identity parameter matrix after nonlinear processing and the communication matrix after nonlinear processing; Generate a dynamic key according to the encryption preprocessing value; The generating a dynamic key according to the encryption preprocessing value comprises: Filling the encryption preprocessing value to obtain a filled encryption preprocessing value; Generate a first sub-encryption preprocessing value and a second sub-encryption preprocessing value according to the padded encryption preprocessing value; Processing the encryption preprocessing value according to the current communication timing information to obtain a third sub-encryption preprocessing value; Processing the first sub-encryption preprocessing value and the third sub-encryption preprocessing value by using an MD5 algorithm to generate a first hash value; The dynamic key is generated according to the first hash value and the second sub-encrypted pre-processed value.
2. The method for generating a dynamic key according to claim 1, characterized in that: The generating a first sub-encryption preprocessing value and a second sub-encryption preprocessing value according to the padded encryption preprocessing value comprises: Performing an XOR calculation on the padded encryption preprocessing value and the first preset value to obtain the first sub-encryption preprocessing value; The padded encryption preprocessing value and the second preset value are XOR-ed to obtain the second sub-encryption preprocessing value.
3. The method for generating a dynamic key according to claim 2, characterized in that: The step of processing the encryption preprocessing value according to the current communication timing information to obtain a third sub-encryption preprocessing value includes: The encryption preprocessing value is processed according to the number of communications to obtain the third sub-encryption preprocessing value.
4. An upgrade package encryption method, characterized in that: Applied to the sender, the methods include: Generate a first dynamic key and a first encryption preprocessing value according to the dynamic key generation method according to any one of claims 1 to 3; Encrypting the upgrade package according to the first dynamic key and the first encryption pre-processing value to obtain a first encrypted upgrade package; Adding the first encryption preprocessing value to the first encryption upgrade package to obtain a second encryption upgrade package; The second encrypted upgrade package is sent to a recipient, so that the recipient generates a second dynamic key and a second encryption preprocessing value according to the dynamic key generation method according to any one of claims 1 to 3, and decrypts the first encrypted upgrade package according to the second dynamic key and the second encryption preprocessing value to obtain a decrypted upgrade package; the integrity of the decrypted upgrade package is verified according to the second dynamic key, and if the verification is successful, the upgrade operation is performed according to the decrypted upgrade package.
5. A software upgrade method, characterized in that: Applied to the receiving side, the methods include: Obtain the second encrypted upgrade package sent by the sender; Acquire a first encryption upgrade package and a first encryption preprocessing value according to the second encryption upgrade package; Generate a second dynamic key and a second encryption preprocessing value according to the dynamic key generation method according to any one of claims 1 to 3; Decrypting the first encrypted upgrade package according to the second dynamic key and the second encryption pre-processing value to obtain a decrypted upgrade package; The integrity of the decrypted upgrade package is verified according to the second dynamic key, and if the verification is successful, an upgrade operation is performed according to the decrypted upgrade package.
6. The software upgrade method according to claim 5, characterized in that: The receiving party includes: a communication module and a terminal; The communication module and the terminal perform two-way authentication under preset conditions; After the two-way authentication succeeds, the terminal obtains the second encrypted upgrade package sent by the sender through the communication module.
7. The software upgrade method according to claim 6, characterized in that: The performing the upgrade operation according to the decrypted upgrade package comprises: Sending the decrypted upgrade package to a test node so that the test node performs a simulated upgrade to obtain a test result; The test result sent by the test node is obtained, and an upgrade operation is performed according to the test result and the decrypted upgrade package.
8. The software upgrade method according to claim 7, characterized in that: The communication module and the terminal perform two-way authentication by the following method: After the communication module and the terminal establish a connection, the communication module generates a time random number, generates a first verification key based on the time random number and a first preset algorithm, and sends the time random number to the terminal; After receiving the time random number, the terminal generates a second verification key based on the time random number and the first preset algorithm; The terminal generates a first challenge code based on the current time, and generates first integrated verification information according to the first challenge code and the terminal verification information; The terminal generates a first identity authentication information ciphertext from the first integrated verification information according to the second verification key and the second preset algorithm; The terminal generates a first identity verification information digest of the first integrated verification information according to the first challenge code and an information digest algorithm; The terminal sends the first identity authentication information ciphertext and the first identity authentication information digest to the communication module; The communication module obtains a second challenge code and a second integrated verification information according to the first verification key, the first identity verification information ciphertext and the second preset algorithm; The communication module generates a second identity verification information digest of the second integrated verification information according to the second challenge code and the information digest algorithm; The communication module compares the first identity authentication information digest with the second identity authentication information digest. If they are consistent, the communication module confirms that the terminal has been authenticated and sends the second challenge code to the terminal. The terminal compares the first challenge code with the second challenge code, and if they are consistent, the terminal confirms that the communication module verification has passed.
9. A software upgrade method, characterized in that: Applied to a software upgrade system, the software upgrade system at least includes: a sender and a receiver; the method includes: The sender generates a first dynamic key and a first encryption preprocessing value according to the dynamic key generation method according to any one of claims 1 to 3; The sender encrypts the upgrade package according to the first dynamic key and the first encryption pre-processing value to obtain a first encrypted upgrade package; The sender adds the first encryption preprocessing value to the first encryption upgrade package to obtain a second encryption upgrade package; The sender sends the second encrypted upgrade package to the receiver; The receiver obtains the second encrypted upgrade package sent by the sender, and obtains the first encrypted upgrade package and the first encrypted pre-processing value according to the second encrypted upgrade package; The receiving party generates a second dynamic key and a second encryption preprocessing value according to the dynamic key generation method according to any one of claims 1 to 3; The receiving party decrypts the first encrypted upgrade package according to the second dynamic key and the second encryption pre-processing value to obtain a decrypted upgrade package; The receiver verifies the integrity of the decrypted upgrade package according to the second dynamic key, and when the verification passes, performs an upgrade operation according to the decrypted upgrade package.
10. A software upgrade system, characterized in that: The software upgrade system includes: a sender and a receiver; The sender is used to generate a first dynamic key and a first encryption preprocessing value according to the dynamic key generation method according to any one of claims 1 to 3; encrypt the upgrade package according to the first dynamic key and the first encryption preprocessing value to obtain a first encrypted upgrade package; add the first encryption preprocessing value to the first encrypted upgrade package to obtain a second encrypted upgrade package; and send the second encrypted upgrade package to the receiver; The sender is used to obtain a second encrypted upgrade package sent by the sender, and obtain the first encrypted upgrade package and the first encrypted pre-processing value according to the second encrypted upgrade package; According to the dynamic key generation method according to any one of claims 1 to 3, a second dynamic key and a second encryption preprocessing value are generated; the first encrypted upgrade package is decrypted according to the second dynamic key and the second encryption preprocessing value to obtain a decrypted upgrade package; the integrity of the decrypted upgrade package is verified according to the second dynamic key, and when the verification is successful, an upgrade operation is performed according to the decrypted upgrade package.
