Data transmission method and system, storage medium and computer equipment

By adjusting the order of ciphertext information and identification information during data transmission, the receiver can read the identification information first to determine the necessity of decoding and decryption, which solves the problem of waste of resources by the receiver during the decoding process and improves data efficiency. processing efficiency.

CN118713904APending Publication Date: 2024-09-27NIO TECH ANHUI CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410946532.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-16
Publication Date
2024-09-27

AI Technical Summary

Technical Problem

During the data transmission process, the receiver cannot determine whether the decryption information of the ciphertext data is correct when decoding the encoded data, causing the decoding process to waste system resources and time.

Method used

By filling the ciphertext information and the identification information used to encrypt the information into the pre-built data structure during data transmission, the identification information is placed before the ciphertext information, so that the recipient can read the identification information first to determine whether it is necessary to Decoding and decryption operations.

Benefits of technology

It improves the data processing efficiency of the receiver and avoids waste of resources and time loss caused by incorrect decryption of information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118713904A
    Figure CN118713904A
Patent Text Reader

Abstract

The invention relates to the technical field of data transmission, and particularly provides a data transmission method and system, a storage medium and computer equipment, and the method comprises the steps: encrypting to-be-transmitted plaintext data through employing preset encryption information, and obtaining ciphertext information; acquiring identification information for identifying the encrypted information; filling a pre-constructed data structure with the identification information and the ciphertext information to obtain a filled data structure; wherein in the filled data structure, the identification information is located in front of the ciphertext information, so that the identification information can be read before the ciphertext information; encoding the filled data structure to obtain encoded data; and sending the coded data to the second terminal. According to the technical scheme provided by the invention, a receiver can obtain the decryption information for decrypting the ciphertext data before decoding the ciphertext data so as to determine whether decoding operation needs to be performed on the ciphertext data or not, so that the data processing efficiency of the receiver is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data transmission, and specifically provides a data transmission method, system, storage medium and computer device. Background Art

[0002] In the process of data transmission, in order to ensure data security, it is generally necessary to encrypt the plaintext data to be transmitted, obtain the ciphertext data, and then encode the ciphertext data and transmit it to the receiver. After receiving the encoded data, the receiver decodes the encoded data, and then decrypts the ciphertext data to obtain the corresponding plaintext data.

[0003] In practical applications, since the receiver often makes decoding errors or decryption errors, the data processing efficiency of obtaining plaintext data based on the above-mentioned encoded data is not high. Therefore, it is necessary to provide a new data transmission scheme to improve the data processing efficiency of the receiver. Summary of the invention

[0004] In order to solve the technical problem of low data processing efficiency at the above-mentioned receiving party, the inventors found that the main reason for the above-mentioned technical problem is that, during the process of decoding the encoded data, the receiving party usually does not know whether the information obtained for decrypting the ciphertext data is correct. If the decryption information is incorrect, the decoded ciphertext data cannot be decrypted. Therefore, the decoding process of the receiving party only wastes system resources and time.

[0005] To this end, the present application proposes a data transmission method, system, storage medium and computer device, which enable the recipient to obtain decryption information used to decrypt the ciphertext data before decoding the ciphertext data, and then determine whether the ciphertext data needs to be decoded, thereby greatly improving the data processing efficiency of the recipient.

[0006] To achieve the above purpose, the technical solution of this application is implemented as follows: In a first aspect, the present application provides a data transmission method, applied to a first terminal; the method comprises: Encrypting the plaintext data to be transmitted using predetermined encryption information to obtain ciphertext information; Acquire identification information for identifying the encrypted information; Filling the identification information and the ciphertext information into a pre-constructed data structure to obtain a filled data structure; wherein, in the filled data structure, the identification information is located before the ciphertext information, so that the identification information can be read before the ciphertext information; Encoding the filled data structure to obtain encoded data; The encoded data is sent to the second terminal.

[0007] In some embodiments, the encryption information includes: a first key, a first encryption algorithm, and an initial vector of the first encryption algorithm; and the step of encrypting the plaintext data to be transmitted using the predetermined encryption information to obtain the ciphertext information includes: Encrypting the plaintext data using the first key, the first encryption algorithm, and the initial vector to obtain ciphertext data of the plaintext data, and using the ciphertext data as the ciphertext information; The obtaining of identification information for identifying the encrypted information includes: The preset identification information of the first key, the preset identification information of the first encryption algorithm, and the preset identification information of the initial vector are respectively obtained.

[0008] In some embodiments, the encryption information includes: a first key, a first encryption algorithm, an initial vector of the first encryption algorithm, a second key, and a second encryption algorithm; and encrypting the plaintext data to be transmitted using the predetermined encryption information to obtain the ciphertext information includes: Encrypting the plaintext data using the first key, the first encryption algorithm, and the initial vector to obtain ciphertext data of the plaintext data; Encrypting the first key using the second key and the second encryption algorithm to obtain an encrypted first key; The ciphertext data and the encrypted first key are used as the ciphertext information; wherein, in the padded data structure, the encrypted first key is located before the ciphertext data, so that the encrypted first key can be read before the ciphertext data; The obtaining of identification information for identifying the encrypted information includes: The preset identification information of the first encryption algorithm, the preset identification information of the initial vector, the preset identification information of the second key, and the preset identification information of the second encryption algorithm are respectively obtained.

[0009] In some embodiments, the preset identification information of the initial vector is the initial vector itself; and the method further includes: Forming dictionary data based on a combination of preset identification information of the first encryption algorithm and the initial vector; Encoding the dictionary data using a CBOR encoding method to obtain an encoded dictionary; Filling the identification information into a pre-built data structure includes: Filling the encoded dictionary into a first predetermined field of the data structure; The preset identification information of the second key and the preset identification information of the second encryption algorithm are filled into a second predetermined field of the data structure.

[0010] In some embodiments, the method further comprises: Digitally signing the plaintext data to obtain signature information; Filling the identification information and the ciphertext information into a pre-constructed data structure to obtain the filled data structure includes: Fill the identification information, the ciphertext information and the signature information into the pre-constructed data structure to obtain the filled data structure; wherein, in the filled data structure, the ciphertext information is located before the signature information, so that the ciphertext information can be read before the signature information.

[0011] In some embodiments, the method further comprises: Converting the signature information into a predetermined structure; Encoding the predetermined structure to obtain encoding signature information; Filling the identification information, the ciphertext information, and the signature information into the pre-built data structure to obtain the filled data structure includes: Fill the identification information, the ciphertext information and the coded signature information into the pre-constructed data structure to obtain the filled data structure; wherein, in the filled data structure, the ciphertext information is located before the coded signature information, so that the ciphertext information can be read before the coded signature information.

[0012] In some embodiments, the method further comprises: Based on the encrypted information, a predetermined algorithm is used to obtain derived encrypted information; Encrypting the coded signature information using the derived encryption information to obtain the coded encrypted signature information; Filling the identification information, the ciphertext information, and the encoded signature information into the pre-built data structure to obtain the filled data structure includes: Fill the identification information, the ciphertext information and the encoded and encrypted signature information into the pre-constructed data structure to obtain the filled data structure; wherein, in the filled data structure, the ciphertext information is located before the encoded and encrypted signature information, so that the ciphertext information can be read before the encoded and encrypted signature information.

[0013] In some embodiments, encoding the padded data structure to obtain encoded data includes: The padded data structure is encoded using a CBOR encoding method to obtain the encoded data.

[0014] In a second aspect, the present application provides a data transmission method, which is applied to a second terminal; the method includes: receiving encoded data; Decoding the encoded data to obtain a padded data structure; wherein the padded data structure is obtained by the first terminal filling the identification information and the ciphertext information into a pre-constructed data structure; in the padded data structure, the identification information is located before the ciphertext information, so that the identification information can be read before the ciphertext information; Based on the identification information, obtaining encrypted information; The encrypted information is used to decrypt the ciphertext information to obtain plaintext data.

[0015] In some embodiments, the method further comprises: Verifying the encrypted information to obtain a verification result of whether the encrypted information is correct; The step of using the encryption information to decrypt the ciphertext information to obtain plaintext data includes: When the encryption information is correct, the ciphertext information is decrypted using the encryption information to obtain the plaintext data.

[0016] In some embodiments, the encryption information includes: a first key, a first encryption algorithm, and an initial vector of the first encryption algorithm; and decrypting the ciphertext information using the encryption information to obtain plaintext data includes: Based on the first key, obtaining a first decryption key; The ciphertext information is decrypted using the first decryption key, the first encryption algorithm and the initial vector to obtain the plaintext data.

[0017] In some embodiments, the encryption information includes: a first encryption algorithm, an initial vector of the first encryption algorithm, a second key, and a second encryption algorithm; the ciphertext information includes: the encrypted first key, and the ciphertext data of the plaintext data; and the decrypting the ciphertext information using the encryption information to obtain the plaintext data includes: Based on the second key, obtaining a second decryption key; Decrypting the encrypted first key using the second decryption key and the second encryption algorithm to obtain the first key; The ciphertext data is decrypted using the first key, the first encryption algorithm, and the initial vector to obtain the plaintext data.

[0018] In some embodiments, in the padded data structure, the encrypted first key is located before the ciphertext data, so that the encrypted first key can be read before the ciphertext data.

[0019] In some embodiments, the filled data structure is also obtained by the first terminal filling identification information, ciphertext information and signature information into a pre-constructed data structure; the method also includes: authenticating the signature information to determine the reliability of the plaintext data.

[0020] In some embodiments, in the padded data structure, the ciphertext information is located before the signature information, so that the ciphertext information can be read before the signature information.

[0021] In some embodiments, the filled data structure is obtained by the first terminal filling the identification information, the ciphertext information and the encoded and encrypted signature information into a pre-constructed data structure; the method further includes: Based on the encrypted information, a predetermined algorithm is used to obtain derived encrypted information; Decrypting the coded encrypted signature information using the derived encrypted information to obtain the coded signature information; Decoding the encoded signature information to obtain signature information; The signature information is authenticated to determine the reliability of the plaintext data.

[0022] In some embodiments, in the padded data structure, the ciphertext information is located before the encoded and encrypted signature information, so that the ciphertext information can be read before the encoded and encrypted signature information.

[0023] In a third aspect, the present application provides a data transmission system, comprising a first terminal and a second terminal; the first terminal is used to execute the data transmission method described in any one of the technical solutions in the above-mentioned first aspect; the second terminal is used to execute the data transmission method described in any one of the technical solutions in the above-mentioned second aspect.

[0024] In a fourth aspect, the present application provides a computer-readable storage medium storing a plurality of program codes, wherein the program codes are suitable for being loaded and run by a processor to execute the data transmission method described in any one of the technical solutions of the first aspect and the second aspect.

[0025] In a fifth aspect, the present application provides a computer device, comprising a storage device and a processor, wherein the storage device stores a program code that can be executed on the processor, and when the program code is executed by the processor, the data transmission method described in any one of the technical solutions of the first aspect and the second aspect is implemented.

[0026] The data transmission method, system, storage medium and computer device provided by the embodiments of the present application are configured to fill the ciphertext information and the identification information for identifying the encrypted information into a pre-constructed data structure, and in the filled data structure, the identification information is located before the ciphertext information, so that the identification information can be read before the ciphertext information, that is, the encrypted information for encrypting the plaintext data can be read before the ciphertext information, so that in the process of decoding the encoded data, the encrypted information can be first decoded to obtain the encrypted information, and then the encrypted information can be verified before determining whether to decode the ciphertext information. If the encrypted information itself is wrong, it is no longer necessary to decode the ciphertext information. It can be seen that the technical solution provided by the present application enables the recipient to obtain the decryption information for decrypting the ciphertext data based on the encryption information before decoding the ciphertext data, and then determine whether to perform a decoding operation on the ciphertext data, thereby greatly improving the data processing efficiency of the recipient. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The disclosure of the present application will become easier to understand with reference to the accompanying drawings. It is easy for those skilled in the art to understand that these drawings are only used for the purpose of illustrating the present application and are not intended to limit the scope of protection of the present application. In addition, similar numbers in the drawings are used to represent similar components, among which: Figure 1 A flowchart of the main steps of the data transmission method executed by the first terminal in an embodiment of the present application; Figure 2 A flowchart of the main steps of the data transmission method executed by the second terminal in an embodiment of the present application; Figure 3 A data interaction flow chart of the first terminal and the second terminal in the embodiment of the present application; Figure 4 This is another data interaction flow chart between the first terminal and the second terminal in the embodiment of the present application; Figure 5 This is a schematic diagram of the structure of the data transmission system in the embodiment of the present application; Figure 6 It is a schematic diagram of the structure of a computer device in an embodiment of the present application. DETAILED DESCRIPTION

[0028] Some embodiments of the present application are described below with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are only used to explain the technical principles of the present application and are not intended to limit the protection scope of the present application.

[0029] In the description of the present application, "module" and "processor" may include hardware, software or a combination of the two. A module may include hardware circuits, various suitable sensors, communication ports, memory, and may also include software parts, such as program code, or a combination of software and hardware. The processor may be a central processing unit, a microprocessor, an image processor, a digital signal processor or any other suitable processor. The processor has data and / or signal processing functions. The processor may be implemented in software, hardware or a combination of the two. Non-temporary computer-readable storage media include any suitable medium that can store program code, such as a disk, a hard disk, an optical disk, a flash memory, a read-only memory, a random access memory, etc. The term "A and / or B" means all possible combinations of A and B, such as only A, only B or A and B. The term "at least one A or B" or "at least one of A and B" has a similar meaning to "A and / or B" and may include only A, only B or A and B. The singular terms "one" and "the" may also include plural forms.

[0030] In the process of data transmission, in order to ensure data security, it is generally necessary to encrypt the plaintext data to be transmitted, obtain the ciphertext data, and then encode the ciphertext data and transmit it to the receiver. After receiving the encoded data, the receiver decodes the encoded data, and then decrypts the ciphertext data to obtain the corresponding plaintext data.

[0031] The problem with the above process is that, when the receiver is decoding the encoded data, it usually does not know whether the information obtained for decrypting the ciphertext data is correct. If the decryption information is incorrect, the decoded ciphertext data cannot be decrypted. Therefore, the receiver's decoding process only wastes system resources and time.

[0032] With the development of intelligent connected vehicles, users are paying more and more attention to the security and efficiency of data transmission. In the intelligent electric vehicle industry, how to safely and quickly transmit vehicle data and user data has received more attention.

[0033] In order to achieve the security and efficiency of data transmission, this application proposes a lightweight data serialization secure data transmission scheme. The public and private keys used in this scheme are generated locally by the communicating parties. Except for the communicating parties themselves, no third party can obtain the private key through man-in-the-middle attacks. The data transmission protocol adopted by this scheme saves more transmission space than the commonly used json, xml and other serialization methods, and the protocol protects data through encryption, encoding and signing operations, achieving data security, user privacy protection and data traceability.

[0034] Based on the above ideas, the present application provides a data transmission method, which is applied to a first terminal. Figure 1 As shown, the data transmission method in the embodiment of the present application includes the operations described in the following steps S101 to S105: Step S101, using predetermined encryption information to encrypt plaintext data to be transmitted to obtain ciphertext information; In this embodiment, the first terminal may be understood as a data sending end, which encrypts the plaintext data and then sends it to the data receiving end.

[0035] In order to encrypt the plaintext data and ensure the security of the plaintext data, in this embodiment, the encryption information includes: a first key, a first encryption algorithm, and an initial vector of the first encryption algorithm. Under this premise, the method of encrypting the plaintext data to be transmitted using the predetermined encryption information in this embodiment to obtain the ciphertext information includes: encrypting the plaintext data using the first key, the first encryption algorithm, and the initial vector to obtain the ciphertext data of the plaintext data, and using the ciphertext data as the ciphertext information.

[0036] In order to more effectively encrypt the plaintext data and further ensure the security of the plaintext data, in this embodiment, the encryption information includes: a first key, a first encryption algorithm, an initial vector of the first encryption algorithm, a second key, and a second encryption algorithm. Under this premise, the method of using the predetermined encryption information to encrypt the plaintext data to be transmitted and obtain the ciphertext information in this embodiment includes: using the first key, the first encryption algorithm, and the initial vector to encrypt the plaintext data to obtain the ciphertext data of the plaintext data; using the second key and the second encryption algorithm to encrypt the first key to obtain the encrypted first key; using the ciphertext data and the encrypted first key as the ciphertext information; wherein, in the padded data structure, the encrypted first key is located before the ciphertext data, so that the encrypted first key can be read before the ciphertext data.

[0037] That is, in this embodiment, the plaintext data to be transmitted can be encrypted in the above two ways. One way is to encrypt the plaintext data by using a preset first key, a preset first encryption algorithm and an initial vector preset by the first encryption algorithm, and the ciphertext data obtained after encryption is the above ciphertext information; the other way is to first encrypt the plaintext data by using a preset first key, a preset first encryption algorithm and an initial vector preset by the first encryption algorithm to obtain ciphertext data, and then encrypt the first key by using a preset second key and a preset second encryption algorithm to obtain an encrypted first key, and use the encrypted first key and the ciphertext data together as the above ciphertext information for subsequent filling into a pre-constructed data structure.

[0038] In this embodiment, the above-mentioned method 1 can adopt a symmetric encryption algorithm or an asymmetric encryption algorithm; the above-mentioned method 2 is envelope encryption, which can adopt a symmetric key encryption algorithm or an asymmetric key encryption algorithm.

[0039] Step S102, obtaining identification information for identifying the encrypted information; In order to enable the data receiving end to obtain the corresponding encryption information, this embodiment needs to identify the encryption information used by the data sending end. In order to conveniently and effectively obtain the identification information, for the above-mentioned method 1 of encrypting plaintext data, the acquisition of identification information used to identify the encryption information described in this embodiment includes: respectively obtaining the preset identification information of the first key, the preset identification information of the first encryption algorithm, and the preset identification information of the initial vector.

[0040] With respect to the above-mentioned second method for encrypting plaintext data, the obtaining of identification information used to identify the encrypted information described in this embodiment includes: respectively obtaining preset identification information of the first encryption algorithm, preset identification information of the initial vector, preset identification information of the second key, and preset identification information of the second encryption algorithm.

[0041] That is, in this embodiment, the identification information corresponding to each encrypted information can be preset, and the communicating parties can agree on the preset identification before communication.

[0042] Step S103, filling the identification information and the ciphertext information into a pre-constructed data structure to obtain a filled data structure; wherein, in the filled data structure, the identification information is located before the ciphertext information, so that the identification information can be read before the ciphertext information; Since the initial vector of the encryption algorithm will also be used in the subsequent decryption of the ciphertext data, in order to enable the data receiving end to more accurately know the initial vector, in this embodiment, the preset identification information of the initial vector is the initial vector itself, that is, when filling the above data structure, the specific value of the initial vector is directly filled in. Under this premise, the method described in this embodiment also includes: forming dictionary data based on the combination of the preset identification information of the first encryption algorithm and the initial vector; encoding the dictionary data using the CBOR encoding method to obtain an encoded dictionary.

[0043] Under the premise of the above-mentioned technical solution, the present embodiment fills the identification information into a pre-constructed data structure, including: filling the encoded dictionary into the first predetermined field of the data structure; filling the preset identification information of the second key and the preset identification information of the second encryption algorithm into the second predetermined field of the data structure.

[0044] Specifically, a fixed field is set in the pre-built data structure, and the system directly fills the above-obtained identification information and ciphertext information into the corresponding fixed fields. Among them, the identification information is divided into the identification information of the encryption information for encrypting the plaintext data and the identification information of the encryption information for encrypting the first key. These two types of identification information are filled into different fields, so that the data receiving end can obtain the corresponding encryption information more conveniently and efficiently.

[0045] In a specific implementation, the pre-built data structure is as follows: NIO_Encrypt = [ protected: map (encoded), / / The dictionary here is first encoded into a string and then assigned to the protected field, rather than being encoded in the form of a data structure unprotected: map, / / Same as above recipients : recipient: [ protected: {} unprotected: { alg =>wrap algorithm, / / Envelope encryption algorithm for symmetric key encryption kid =>keyIdentifier / / keyId of the public and private key pair for encrypting the symmetric key }, ciphertext: encryted AEAD key / / Encrypted AEAD algorithm symmetric key ] ciphertext : ciphertext data, binary string or empty ] Among them, the first predetermined field is the protected field in the above structure, and the second predetermined field is the recipients field in the above structure. When the above method 1 is used to encrypt plaintext data, it is only necessary to fill the identification information of the first key, the identification information of the first encryption algorithm and the initial vector of the first encryption algorithm in the first predetermined field protected; when the above method 2 is used to encrypt plaintext data, it is necessary to fill the first predetermined field protected and the second predetermined field recipients. Among them, the above-mentioned encoded dictionary is filled in the first predetermined field protected, that is, the identification information of the first encryption algorithm and the initial vector of the first encryption algorithm are filled; the identification information of the second key and the identification information of the second encryption algorithm are filled in the second predetermined field recipients. In addition, in the above structure, the ciphertext field is used to fill the encrypted first key, and the ciphertext field is used to fill the ciphertext data of the plaintext data.

[0046] The above NIO_Encrypt structure has the following advantages: The recipients field (key-related information) is placed before the ciphertext field. After the recipient learns the content in the recipients field and finds that the information is wrong, it is no longer necessary to decode the ciphertext data in the ciphertext field, thereby optimizing the decoding and decryption process.

[0047] Using the AEAD (Authenticated Encryption with Associated Data) algorithm to encrypt and decrypt plaintext data can ensure the integrity of the ciphertext and the correctness of the decryption to the greatest extent.

[0048] In this embodiment, the above-mentioned AEAD algorithm for encrypting plaintext data can of course be replaced by other algorithms according to actual applications, and this embodiment does not impose any specific restrictions on this.

[0049] In the above NIO_Encrypt structure, the value of the protected field is the binary string encoded by the cbor map object, that is, the binary string obtained by encoding the map dictionary in CBOR mode. In this embodiment, the map dictionary contains at least the following label information as necessary input for encryption and decryption operations: Alg: OID information of AEAD encryption algorithm, that is, identification information of AEAD encryption algorithm, indicating the specific symmetric algorithm information used for encryption and decryption.

[0050] IV: The initial vector of the encryption algorithm, used by the decryptor to decrypt the ciphertext.

[0051] In the above NIO_Encrypt structure, the recipient field contains information for decrypting the AEAD encryption key (i.e., the first encrypted key). As shown in the structure, the recipient array structure in this embodiment reserves a protected field, and stores the algorithm information for decrypting the encryption key in the dictionary represented by the unprotected field so that the decryption party can extract the key information. In this embodiment, the unprotected map dictionary contains at least the following label information as necessary input for the envelope encryption and decryption operation: Alg: OID information of the envelope encryption and decryption algorithm, that is, the identification information of the encryption algorithm used to encrypt the first key, indicating which type of envelope encryption and decryption algorithm is used, such as asymmetric public key encryption algorithm information such as RSAEncryption and ECIES, or symmetric key encryption algorithm information such as AESWrap; using asymmetric keys for envelope encryption can improve data security compared to symmetric encryption.

[0052] Kid: The identity of the envelope encryption and decryption key, which is customized by the user. The length of the above identity used in this embodiment is 20-octets.

[0053] For the above data structure NIO_Encrypt, the two communicating parties (the first terminal and the second terminal, or the data sending end and the data receiving end) need to have the following communication preparations: 1. Both parties need to hold each other's public key certificate information for envelope encryption.

[0054] 2. If the communicating parties decide to use symmetric keys for envelope encryption and decryption, they need to preset the same symmetric keys in advance.

[0055] Preferably, in order to ensure the security and traceability of data transmission, the method described in this embodiment further includes: digitally signing the plaintext data to obtain signature information. Under this premise, the method described in this embodiment of filling the identification information and the ciphertext information into a pre-constructed data structure to obtain the filled data structure includes: filling the identification information, the ciphertext information and the signature information into the pre-constructed data structure to obtain the filled data structure; wherein, in the filled data structure, the ciphertext information is located before the signature information, so that the ciphertext information can be read before the signature information.

[0056] In order to further ensure the security of data transmission, the method described in this embodiment also includes: converting the signature information into a predetermined structure; encoding the predetermined structure to obtain the encoded signature information. Under this premise, the method described in this embodiment of filling the identification information, the ciphertext information and the signature information into the pre-constructed data structure to obtain the filled data structure includes: filling the identification information, the ciphertext information and the encoded signature information into the pre-constructed data structure to obtain the filled data structure; wherein, in the filled data structure, the ciphertext information is located before the encoded signature information, so that the ciphertext information can be read before the encoded signature information.

[0057] In order to ensure the security of the signature information and further ensure the security of data transmission, the method described in this embodiment also includes: based on the encrypted information, using a predetermined algorithm to obtain the derived encrypted information; using the derived encrypted information to encrypt the coded signature information to obtain the coded encrypted signature information. Under this premise, the method described in this embodiment of filling the identification information, the ciphertext information and the coded signature information into the pre-constructed data structure to obtain the filled data structure includes: filling the identification information, the ciphertext information and the coded encrypted signature information into the pre-constructed data structure to obtain the filled data structure; wherein, in the filled data structure, the ciphertext information is located before the coded encrypted signature information, so that the ciphertext information can be read before the coded encrypted signature information.

[0058] That is, in this embodiment, a signature information field is also provided in the above-mentioned pre-constructed data structure, which is used to fill in the signature information of the plaintext data to ensure the traceability and further security of the plaintext data.

[0059] In this embodiment, the ciphertext information is set before the signature information so that the ciphertext information can be read before the signature information. In this way, the corresponding plaintext data does not need to be repeatedly filled in the signature information, thereby simplifying the data structure and saving transmission space.

[0060] In a specific implementation, the data structure containing the above signature information is as follows: NIO_SignEncrypt = [ protected: map (encoded bstr), / / The dictionary here is first encoded into a string and then assigned to the protected field, rather than being encoded in the form of a data structure unprotected: map, / / dictionary structure, no encoding required recipients : recipient: [ protected: {} unprotected: { alg =>wrap algorithm, / / Envelope encryption algorithm for symmetric key encryption kid =>keyIdentifier / / keyId of the public and private key pair for encrypting the symmetric key }, ciphertext: encryted AEAD key / / Encrypted AEAD algorithm symmetric key ] ciphertext : ciphertext data, binary string or NULL sig_ciphertext: signature information, binary string, the corresponding data structure is COSE_Sign1_Tagged or COSE_Sign_Tagged [RFC 9052] ] This structure adds a sig_ciphertext field based on the data structure NIO_Encrypt described above to fill in the signature information.

[0061] Among them, the data structure COSE_Sign1_Tagged is as follows: COSE_Sign1 = [ protected: { alg =>signature algorithm, nio_signing_time =>current time (epoch seconds), x5chain =>signer's cert chain [RFC 9360] }, unprotected: {}, payload: nil, signature: the signature value ] In the COSE_Sign1_Tagged structure, the protected field is filled with the signature algorithm, signing time, and signing certificate chain; the signature field is filled with specific signature information.

[0062] The above NIO_SignEncrypt structure has the following advantages: 1. The recipients field (key-related information) is placed before the ciphertext field. After the recipient learns the content in the recipients field and finds that the information is wrong, it is no longer necessary to decode the ciphertext data in the ciphertext field, thus optimizing the decoding and decryption process.

[0063] 2. Using the AEAD (Authenticated Encryption with Associated Data) algorithm to encrypt and decrypt plaintext data can ensure the integrity of the ciphertext and the correctness of the decryption to the greatest extent.

[0064] 3. The newly added sig_ciphertext field represents the encrypted signature information to ensure the traceability of the information after the ciphertext information is restored.

[0065] In this embodiment, the above-mentioned AEAD algorithm for encrypting plaintext data can of course be replaced by other algorithms according to actual applications, and this embodiment does not impose any specific restrictions on this.

[0066] In the above NIO_SignEncrypt structure, the value of the protected field is the binary string encoded by the cbor map object, that is, the binary string obtained by encoding the map dictionary in CBOR mode. In this embodiment, the map dictionary contains at least the following label information as necessary input for encryption and decryption operations: 1. Alg: OID information of AEAD encryption algorithm, that is, identification information of AEAD encryption algorithm, indicating the specific symmetric algorithm information used for encryption and decryption.

[0067] 2. IV: The initial vector of the encryption algorithm, used by the decryptor to decrypt the ciphertext. Since the same IV cannot be reused in the encryption process of the same key, the IV of the signed ciphertext will be derived from the IV.

[0068] In the above NIO_SignEncrypt structure, the recipient field contains information for decrypting the AEAD encryption key (i.e., the encrypted first key). As shown in the structure, the recipient array structure in this embodiment reserves a protected field, and stores the algorithm information for decrypting the encryption key in the dictionary represented by the unprotected field so that the decryption party can extract the key information. In this embodiment, the unprotected map dictionary contains at least the following label information as necessary input for the envelope encryption and decryption operation: 1. Alg: OID information of the envelope encryption and decryption algorithm, that is, the identification information of the encryption algorithm used to encrypt the first key, indicating which type of envelope encryption and decryption algorithm is used, such as asymmetric public key encryption algorithm information such as RSAEncryption and ECIES, or symmetric key encryption algorithm information such as AESWrap; using asymmetric keys for envelope encryption can improve data security compared to symmetric encryption.

[0069] 2. Kid: The identity of the envelope encryption and decryption key, which is customized by the user. The length of the above identity used in this embodiment is 20-octets.

[0070] In the above NIO_SignEncrypt structure, sig_ciphertext contains the encrypted COSE_Sign1_Tagged or COSE_Sign_Tagged structure code. Different from COSE regulations, this field has the following characteristics: 1. Since the plaintext data can be restored through the ciphertext field, the payload field information in the Cose_Sign1_Tagged or COSE_Sign_Tagged structure is left blank and does not need to be repeatedly filled in to save space.

[0071] 2. The plaintext data of sig_ciphertext is also restored through the keys in the protected field and the recipient field and related algorithm information. However, according to security requirements, the same IV cannot be used twice in an AEAD algorithm key encryption. Therefore, the IV of sig_ciphertext uses the IV in the protected field XORed with 0xFF...FF to form a new IV for encryption and decryption.

[0072] 3. Encrypting the signature structure code can prevent external tampering with the message content and avoid affecting service communications through hash collisions, replay attacks, etc.

[0073] For the above data structure NIO_SignEncrypt, the two communicating parties (the first terminal and the second terminal, or the data sending end and the data receiving end) need to have the following communication preparations: 1. Both parties need to hold each other's public key certificate information for envelope encryption.

[0074] 2. If the communicating parties decide to use symmetric keys for envelope encryption and decryption, they need to preset the same symmetric keys in advance.

[0075] 3. Both communicating parties need to have a certificate chain issued by a trusted CA to verify the validity of the signature information.

[0076] Step S104, encoding the filled data structure to obtain encoded data; In this embodiment, encoding the filled data structure to obtain the encoded data includes: encoding the filled data structure using a CBOR encoding method to obtain the encoded data.

[0077] Concise Binary Object Representation (CBOR [RFC 7049]) is a binary serialization data format based on JSON created by C. Borman. Like JSON, it allows the transmission of data objects containing key-value pairs and is suitable for different application scenarios, including data exchange, network communication, configuration files, etc. It can improve data processing and transmission speed through a more concise encoding method.

[0078] Since its introduction, the CBOR protocol has added many supported data types, of which there are 8 types of data that are mainly used. CBOR encoded data is regarded as a stream of data items. Each data item consists of a header byte of 8 bits, which contains a 3-bit type representation and a 5-bit short count (data length). Next is the optional extended count (if the short count is in the range of 24-27) and the optional entity data information representation. The specific encoding and decoding examples are shown in Examples 1 and 2. Example 1 is an array encoding. The main type identifier of the array is 4, the overall array length is 3, and the bit representation is 100_00011 (the first three bits represent the type, and the last 5 bits represent the length), so the first byte after encoding is 0x83.

[0079] Example 1, array encoding: Raw data: [1, [2, 3], [4, 5]] Encoded data: 0x8301820203820405 Encoding analysis: 83# Array identifier of length 3 01# Unsigned integer 1 82# Array identifier of length 2 02# Unsigned integer 2 03# Unsigned integer 3 82# Array identifier of length 2 04# Unsigned integer 4 05# Unsigned integer 5 Example 2, array nested dictionary encoding: Original data: [2, {12: [h'74686973206973206365727420302C206920616D207265616C6C7920686170707900',h'74686973206973206365727420312C206E696F206973207265616C6C7920676F6F6400']}] Encoded data: 0x8202A10C82582274686973206973206365727420302C206920616D207265616C6C7920686170707900582374686973206973206365727420312C206E696F206973207265616C6C7920676F6F6400 Encoding analysis: 82# Array of length 2 02# Unsigned integer 2 A1 # map of length 1 0C # unsigned integer 12 82# Array of length 2 58 22 # Binary string of length 34 74686973206973206365727420302C206920616D207265616C6C7920686170707900 # byte string info 58 23 # Binary string of length 35 74686973206973206365727420312C206E696F206973207265616C6C7920676F6F6400 # byte string info Step S105: sending the encoded data to the second terminal.

[0080] In this embodiment, the second terminal can be understood as a data receiving end.

[0081] Although the existing data transmission scheme uses signature and encryption algorithms, it has the following disadvantages during application: 1. The existing scheme places the relevant information including the symmetric encryption key after the ciphertext information. When the ciphertext information is long, the user can only decode the ciphertext information according to the decoding rules, store it in the memory temporarily, and then decode the relevant information such as the key. If the relevant information such as the key is wrong, the decoding process of the ciphertext information will only waste system resources and processing time.

[0082] 2. When the ciphertext information is long, the length of the ciphertext information is expressed as infinite-length. At this time, the user cannot skip the ciphertext information by skipping the length and directly read the key-related information. Therefore, the existing solution is not very user-friendly.

[0083] 3. The existing solution does not provide a data structure that can encrypt and sign data at the same time. This means that if a user needs to encrypt and sign data at the same time, according to the existing solution, it is necessary to set up the data structure separately, splice the two data structures, and then encode and transmit them separately. This operation is a waste of limited system resources and transmission time.

[0084] The data transmission scheme and data structure designed in this application is a new lightweight serialized secure data structure and data encoding and decoding transmission process. Through this scheme, the resource problem and development complexity problem of common communication protocols in transmitting secure data are solved, and the problems of unfriendly encoding and decoding and lack of simultaneous encryption and signature data structure in existing schemes are also solved.

[0085] On the other hand, an embodiment of the present application provides a data transmission method, which is applied to a second terminal. Figure 2 As shown, the data transmission method in the embodiment of the present application includes the operations described in the following steps S201 to S204: Step S201, receiving coded data; In this embodiment, the second terminal may be understood as a data receiving terminal, which receives the encoded data sent by the first terminal, that is, the data sending terminal.

[0086] Step S202, decoding the encoded data to obtain a filled data structure; wherein the filled data structure is obtained by the first terminal filling the identification information and the ciphertext information into a pre-constructed data structure; in the filled data structure, the identification information is located before the ciphertext information, so that the identification information can be read before the ciphertext information; In this embodiment, the pre-constructed data structure is as described above and will not be repeated here.

[0087] Step S203, obtaining encryption information based on the identification information; In this embodiment, the identification information is used to identify the encrypted information. In the case of multiple encrypted information, each encrypted information is preset with an identification corresponding thereto. The data receiving end can obtain the encrypted information corresponding to the identification information according to the identification information obtained by decoding.

[0088] Step S204: Decrypt the ciphertext information using the encryption information to obtain plaintext data.

[0089] In order to accurately and effectively obtain plaintext data, in this embodiment, the encryption information includes: a first key, a first encryption algorithm, and an initial vector of the first encryption algorithm. Under this premise, the use of the encryption information to decrypt the ciphertext information to obtain the plaintext data in this embodiment includes: obtaining a first decryption key based on the first key; and using the first decryption key, the first encryption algorithm, and the initial vector to decrypt the ciphertext information to obtain the plaintext data.

[0090] In order to further accurately and effectively obtain plaintext data, in this embodiment, the encryption information includes: a first encryption algorithm, an initial vector of the first encryption algorithm, a second key, and a second encryption algorithm; the ciphertext information includes: an encrypted first key, and the ciphertext data of the plaintext data. Under this premise, the use of the encryption information to decrypt the ciphertext information to obtain the plaintext data in this embodiment includes: obtaining a second decryption key based on the second key; using the second decryption key and the second encryption algorithm to decrypt the encrypted first key to obtain the first key; using the first key, the first encryption algorithm and the initial vector to decrypt the ciphertext data to obtain the plaintext data.

[0091] That is, in this embodiment, the plaintext data to be transmitted can be decrypted by the above two methods. The specific decryption method depends on the data encryption method adopted by the data sender. If the plaintext data is encrypted by the first key, the first encryption algorithm and the initial vector preset by the first encryption algorithm, the above method 1 is used for decryption accordingly; if the plaintext data is first encrypted by the first key, the first encryption algorithm and the initial vector preset by the first encryption algorithm to obtain ciphertext data, and then the first key is encrypted by the second key and the second encryption algorithm to obtain the encrypted first key, the above method 2 is used for decryption accordingly.

[0092] In this embodiment, in the padded data structure, the encrypted first key is located before the ciphertext data, so that the encrypted first key can be read before the ciphertext data.

[0093] Specifically, the encrypted first key is located before the ciphertext data, so that the data receiving end can read the encrypted first key first. After obtaining the first key through the encrypted first key, it can determine whether the ciphertext data needs to be decoded based on the correctness of each key information, thereby saving system resources and data processing time.

[0094] Based on this, the method described in this embodiment also includes: verifying the encrypted information to obtain a verification result of whether the encrypted information is correct; using the encrypted information to decrypt the ciphertext information to obtain plaintext data, including: when the encrypted information is correct, using the encrypted information to decrypt the ciphertext information to obtain the plaintext data.

[0095] In this embodiment, when the encrypted information is erroneous, there is no need to decrypt the ciphertext information, thereby saving system resources and data processing time.

[0096] In order to further ensure the security and traceability of data transmission, in this embodiment, the filled data structure is also obtained by the first terminal filling the identification information, ciphertext information and signature information into the pre-constructed data structure. Under this premise, the method described in this embodiment also includes: authenticating the signature information to determine the reliability of the plaintext data.

[0097] In this embodiment, in the above-mentioned filled data structure, the ciphertext information is located before the signature information, so that the ciphertext information can be read before the signature information. In this way, the corresponding plaintext data does not need to be repeatedly filled in the signature information, thereby simplifying the data structure and saving transmission space.

[0098] In order to further ensure the security and traceability of data transmission, in this embodiment, the filled data structure is also obtained by the first terminal filling the identification information, ciphertext information and the encoded and encrypted signature information into the pre-constructed data structure. Under this premise, the method described in this embodiment also includes: based on the encrypted information, using a predetermined algorithm to obtain the derived encrypted information; using the derived encrypted information to decrypt the encoded and encrypted signature information to obtain the encoded signature information; decoding the encoded signature information to obtain the signature information; authenticating the signature information to determine the reliability of the plaintext data.

[0099] In this embodiment, in the above-mentioned padded data structure, the ciphertext information is located before the encoded and encrypted signature information, so that the ciphertext information can be read before the encoded and encrypted signature information. In this way, the encoded and encrypted signature information does not need to be repeatedly filled with the corresponding plaintext data, thereby simplifying the data structure and saving transmission space.

[0100] Based on the above steps S101-S105 and steps S201-S204, the present application solves the technical problem that in the prior art, when decoding encoded data, system resources and data processing time are wasted because the ciphertext data needs to be decoded first, and the encryption information / decryption information is incorrect.

[0101] It should be pointed out that although the various steps in the above embodiments are described in a specific order, those skilled in the art can understand that in order to achieve the effect of the present application, different steps do not have to be performed in such an order. They can be performed simultaneously (in parallel) or in other orders. These changes are within the scope of protection of the present application.

[0102] Furthermore, the present application also provides a data transmission system, such as Figure 5 As shown, it includes a first terminal and a second terminal. The first terminal is used to execute the data transmission method described in the above steps S101 to S105; the second terminal is used to execute the data transmission method described in the above steps S201 to S204.

[0103] The specific data interaction flow chart is as follows Figure 3 and Figure 4 As shown. Among them, Figure 3 A flow chart of data interaction between the first terminal and the second terminal is shown when the data structure adopted by the first terminal is NIO_Encrypt; Figure 4 The flowchart of data interaction between the first terminal and the second terminal is shown when the data structure adopted by the first terminal is NIO_SignEncrypt.

[0104] In this embodiment, the first terminal and the second terminal may be any terminals in the Internet of Vehicles, that is, the above solution described in this embodiment may be applied to the Internet of Vehicles.

[0105] Among them, the Internet of Vehicles refers to the network communication technology applied to vehicles. This technology is based on the intra-vehicle network, inter-vehicle network and in-vehicle mobile Internet. According to the agreed communication protocol and data interaction standard, it is a large system network for wireless communication and information exchange between vehicles and X (vehicles, roads, people and the cloud, etc.) (Vehicle to X, V2X), that is, it can realize real-time online communication between vehicles, vehicles and facilities, vehicles and the cloud, etc. Among them, the communication between vehicles is also called vehicle-to-vehicle communication (Vehicle to Vehicle, V2V); the communication between vehicles and facilities is also called vehicle-to-infrastructure communication (Vehicle to Infrastructure, V2I), which refers to the communication between vehicles and roads through roadside communication equipment; the communication between vehicles and the cloud is also called vehicle-to-cloud communication (Vehicle to Network, V2N), which refers to the communication between vehicles and the cloud through cellular networks.

[0106] The technical solution provided by the embodiment of the present application is to fill the ciphertext information and the identification information for identifying the encrypted information into a pre-constructed data structure, and in the filled data structure, the above identification information is located before the ciphertext information, so that the identification information can be read before the ciphertext information, that is, the encrypted information for encrypting the plaintext data can be read before the ciphertext information, so that in the process of decoding the encoded data, the encrypted information can be first decoded to obtain the encrypted information, and then the encrypted information can be verified before determining whether to decode the ciphertext information. If the encrypted information itself is wrong, it is no longer necessary to decode the ciphertext information. It can be seen that the technical solution provided by the present application can enable the recipient to obtain the decryption information for decrypting the ciphertext data based on the above encryption information before decoding the ciphertext data, and then determine whether to perform a decoding operation on the ciphertext data, thereby greatly improving the data processing efficiency of the recipient.

[0107] This application also has the following advantages: 1. Use the CBOR protocol as the underlying data encoding and decoding solution to improve transmission efficiency.

[0108] 2. Provide new data structures to save system resources and avoid resource waste.

[0109] 3. Optimize the encoding and decoding process of data interaction and improve the efficiency of secure data decryption.

[0110] Furthermore, the present application also provides a computer-readable storage medium. In a computer-readable storage medium embodiment according to the present application, the computer-readable storage medium can be configured to store a program for executing the data transmission method of the above-mentioned method embodiment, and the program can be loaded and run by the processor to implement the above-mentioned data transmission method. For ease of explanation, only the parts related to the embodiment of the present application are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present application. The computer-readable storage medium can be a storage device formed by various electronic devices. Optionally, the computer-readable storage medium in the embodiment of the present application is a non-temporary computer-readable storage medium.

[0111] Furthermore, the present application also provides a computer device, such as Figure 6 As shown, the computer device includes a storage device and a processor, the storage device stores program code that can be run on the processor, and when the program code is executed by the processor, the data transmission method described in any one of the above-mentioned data transmission method technical solutions is implemented.

[0112] In this embodiment, the storage device in the computer device may be configured to store a program for executing the data transmission method of the above method embodiment, and the processor may be configured to execute the program in the storage device, which includes but is not limited to the program for executing the data transmission method of the above method embodiment. For ease of explanation, only the part related to the embodiment of the present invention is shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present invention.

[0113] In the embodiment of the present application, the computer device may be a control device formed by various electronic devices. In some possible implementations, the device may include multiple storage devices and multiple processors. The program for executing the data transmission method of the above method embodiment may be divided into multiple subprograms, each of which may be loaded and run by a processor to execute different steps of the data transmission method of the above method embodiment. Specifically, each subprogram may be stored in different memories, and each processor may be configured to execute programs in one or more memories to jointly implement the data transmission method of the above method embodiment, that is, each processor executes different steps of the data transmission method of the above method embodiment to jointly implement the data transmission method of the above method embodiment.

[0114] The above-mentioned multiple processors may be processors deployed on the same device. For example, the above-mentioned computer device may be a high-performance device composed of multiple processors, and the above-mentioned multiple processors may be processors configured on the high-performance device. In addition, the above-mentioned multiple processors may also be processors deployed on different devices. For example, the above-mentioned computer device may be a server cluster, and the above-mentioned multiple processors may be processors on different servers in the server cluster.

[0115] It is understood by those skilled in the art that all or part of the processes in the method for implementing the above-mentioned embodiment of the present application can also be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of each of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device, medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory, random access memory, electric carrier signal, telecommunication signal and software distribution medium that can carry the computer program code. It should be noted that the content contained in the computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media do not include electric carrier signals and telecommunication signals.

[0116] So far, the technical solutions of the present application have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present application is obviously not limited to these specific embodiments. Without departing from the principles of the present application, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present application.

Claims

1. A data transmission method, applied to a first terminal, characterized in that: The method comprises: Encrypting the plaintext data to be transmitted using predetermined encryption information to obtain ciphertext information; Acquire identification information for identifying the encrypted information; Filling the identification information and the ciphertext information into a pre-constructed data structure to obtain a filled data structure; wherein, in the filled data structure, the identification information is located before the ciphertext information, so that the identification information can be read before the ciphertext information; Encoding the filled data structure to obtain encoded data; The encoded data is sent to the second terminal.

2. The data transmission method according to claim 1, characterized in that: The encryption information includes: a first key, a first encryption algorithm and an initial vector of the first encryption algorithm; the step of encrypting the plaintext data to be transmitted by using the predetermined encryption information to obtain the ciphertext information includes: Encrypting the plaintext data using the first key, the first encryption algorithm, and the initial vector to obtain ciphertext data of the plaintext data, and using the ciphertext data as the ciphertext information; The obtaining of identification information for identifying the encrypted information includes: The preset identification information of the first key, the preset identification information of the first encryption algorithm, and the preset identification information of the initial vector are respectively obtained.

3. The data transmission method according to claim 1, characterized in that: The encryption information includes: a first key, a first encryption algorithm, an initial vector of the first encryption algorithm, a second key, and a second encryption algorithm; the method of encrypting the plaintext data to be transmitted using the predetermined encryption information to obtain the ciphertext information includes: Encrypting the plaintext data using the first key, the first encryption algorithm, and the initial vector to obtain ciphertext data of the plaintext data; Encrypting the first key using the second key and the second encryption algorithm to obtain an encrypted first key; The ciphertext data and the encrypted first key are used as the ciphertext information; wherein, in the padded data structure, the encrypted first key is located before the ciphertext data, so that the encrypted first key can be read before the ciphertext data; The obtaining of identification information for identifying the encrypted information includes: The preset identification information of the first encryption algorithm, the preset identification information of the initial vector, the preset identification information of the second key, and the preset identification information of the second encryption algorithm are respectively obtained.

4. The data transmission method according to claim 3, characterized in that: The preset identification information of the initial vector is the initial vector itself; the method further includes: Forming dictionary data based on a combination of preset identification information of the first encryption algorithm and the initial vector; Encoding the dictionary data using a CBOR encoding method to obtain an encoded dictionary; Filling the identification information into a pre-built data structure includes: Filling the encoded dictionary into a first predetermined field of the data structure; The preset identification information of the second key and the preset identification information of the second encryption algorithm are filled into a second predetermined field of the data structure.

5. The data transmission method according to claim 1, characterized in that: The method further comprises: Digitally signing the plaintext data to obtain signature information; Filling the identification information and the ciphertext information into a pre-constructed data structure to obtain the filled data structure includes: Fill the identification information, the ciphertext information and the signature information into the pre-constructed data structure to obtain the filled data structure; wherein, in the filled data structure, the ciphertext information is located before the signature information, so that the ciphertext information can be read before the signature information.

6. The data transmission method according to claim 5, characterized in that: The method further comprises: Converting the signature information into a predetermined structure; Encoding the predetermined structure to obtain encoding signature information; Filling the identification information, the ciphertext information, and the signature information into the pre-built data structure to obtain the filled data structure includes: Fill the identification information, the ciphertext information and the coded signature information into the pre-constructed data structure to obtain the filled data structure; wherein, in the filled data structure, the ciphertext information is located before the coded signature information, so that the ciphertext information can be read before the coded signature information.

7. The data transmission method according to claim 6, characterized in that: The method further comprises: Based on the encrypted information, a predetermined algorithm is used to obtain derived encrypted information; Encrypting the coded signature information using the derived encryption information to obtain the coded encrypted signature information; Filling the identification information, the ciphertext information, and the encoded signature information into the pre-built data structure to obtain the filled data structure includes: Fill the identification information, the ciphertext information and the encoded and encrypted signature information into the pre-constructed data structure to obtain the filled data structure; wherein, in the filled data structure, the ciphertext information is located before the encoded and encrypted signature information, so that the ciphertext information can be read before the encoded and encrypted signature information.

8. The data transmission method according to claim 1, characterized in that: The step of encoding the filled data structure to obtain encoded data includes: The padded data structure is encoded using a CBOR encoding method to obtain the encoded data.

9. A data transmission method, applied to a second terminal, characterized in that: The method comprises: receiving encoded data; Decoding the encoded data to obtain a padded data structure; wherein the padded data structure is obtained by the first terminal filling the identification information and the ciphertext information into a pre-constructed data structure; in the padded data structure, the identification information is located before the ciphertext information, so that the identification information can be read before the ciphertext information; Based on the identification information, obtaining encrypted information; The encrypted information is used to decrypt the ciphertext information to obtain plaintext data.

10. The data transmission method according to claim 9, characterized in that: The method further comprises: Verifying the encrypted information to obtain a verification result of whether the encrypted information is correct; The step of using the encryption information to decrypt the ciphertext information to obtain plaintext data includes: When the encryption information is correct, the ciphertext information is decrypted using the encryption information to obtain the plaintext data.

11. The data transmission method according to claim 9, characterized in that: The encryption information includes: a first key, a first encryption algorithm, and an initial vector of the first encryption algorithm; and the decrypting the ciphertext information using the encryption information to obtain plaintext data includes: Based on the first key, obtaining a first decryption key; The ciphertext information is decrypted using the first decryption key, the first encryption algorithm and the initial vector to obtain the plaintext data.

12. The data transmission method according to claim 9, characterized in that: The encryption information includes: a first encryption algorithm, an initial vector of the first encryption algorithm, a second key, and a second encryption algorithm; the ciphertext information includes: the encrypted first key, and the ciphertext data of the plaintext data; the decrypting the ciphertext information using the encryption information to obtain the plaintext data includes: Based on the second key, obtaining a second decryption key; Decrypting the encrypted first key using the second decryption key and the second encryption algorithm to obtain the first key; The ciphertext data is decrypted using the first key, the first encryption algorithm, and the initial vector to obtain the plaintext data.

13. The data transmission method according to claim 12, characterized in that: In the padded data structure, the encrypted first key is located before the ciphertext data, so that the encrypted first key can be read before the ciphertext data.

14. The data transmission method according to claim 9, characterized in that: The filled data structure is also obtained by the first terminal filling the identification information, the ciphertext information and the signature information into the pre-built data structure; the method further includes: The signature information is authenticated to determine the reliability of the plaintext data.

15. The data transmission method according to claim 14, characterized in that: In the padded data structure, the ciphertext information is located before the signature information, so that the ciphertext information can be read before the signature information.

16. The data transmission method according to claim 9, characterized in that: The filled data structure is also obtained by the first terminal filling the identification information, the ciphertext information and the encoded and encrypted signature information into the pre-constructed data structure; the method also includes: Based on the encrypted information, a predetermined algorithm is used to obtain derived encrypted information; Decrypting the coded encrypted signature information using the derived encrypted information to obtain the coded signature information; Decoding the encoded signature information to obtain signature information; The signature information is authenticated to determine the reliability of the plaintext data.

17. The data transmission method according to claim 16, characterized in that: In the padded data structure, the ciphertext information is located before the encoded and encrypted signature information, so that the ciphertext information can be read before the encoded and encrypted signature information.

18. A data transmission system, comprising a first terminal and a second terminal; characterized in that: The first terminal is used to execute the data transmission method according to any one of claims 1 to 8; The second terminal is used to execute the data transmission method described in any one of claims 9-17.

19. A computer-readable storage medium storing a plurality of program codes, characterized in that: The program code is suitable for being loaded and run by a processor to execute the data transmission method according to any one of claims 1 to 8 or 9 to 17.

20. A computer device, characterized in that: The computer device includes a storage device and a processor, the storage device stores a program code that can be executed on the processor, and when the program code is executed by the processor, the data transmission method according to any one of claims 1 to 8 or 9 to 17 is implemented.

Citation Information

Cited By

  • Data transmission method, electronic equipment and storage medium

    CN121690552A