Data Transmission Method, Device, Storage Medium and Electronic Device
By obtaining the environment information in which the device is located, it generates the initialization vector and performs encrypted transmission, the problem that the initialization vector plaintext transmission is easily tracked is solved, and the security and convenience of data transmission are improved.
Patent Information
- Application Number
- CN202111646936.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-29
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2041-12-29
AI Technical Summary
In the prior art, during data transmission, the plaintext transmission of the initialization vector is easily tracked by devices in the same environment, resulting in insufficient security of data transmission.
By obtaining the environment information in which the device is located, the initialization vector is generated and transmitted to the counterpart device, the initialization vector is avoided directly transmitting the initialization vector, and the symmetric key and environment information are used for encryption, reducing the probability of device tracking.
It improves the security and convenience of data transmission, reduces the possibility of device tracking, and optimizes the data transmission process.
Smart Images

Figure CN114363888B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data transmission method, device, storage medium, and electronic device. Background Art
[0002] With the rapid development of communication technology, communication systems are no longer limited to traditional streaming services such as audio and video, but are moving towards a variety of data services. With the development of diverse data services, security requirements such as encrypting data transmission, decrypting data upon reception, and preventing device tracking during transmission are becoming increasingly important. Summary of the Invention
[0003] The present invention provides a data transmission method, device, storage medium, and electronic device. The technical solution is as follows:
[0004] In a first aspect, an embodiment of the present application provides a data transmission method, the method comprising:
[0005] Acquiring environmental information, and transmitting the environmental information to a second device;
[0006] Obtaining a symmetric key and reference initial parameters for the second device, and generating an initialization vector based on the environment information and the reference initial parameters;
[0007] The first data is encrypted based on the symmetric key and the initialization vector to obtain second data, and the second data is sent to the second device, where the second data is used to instruct the second device to decrypt the second data based on the reference initial parameters, the symmetric key and the environmental information.
[0008] In a second aspect, an embodiment of the present application provides a data transmission method, the method comprising:
[0009] Acquire environmental information transmitted by a first device, and receive second data sent by the first device; the second data is generated by encrypting the first data based on an initialization vector and a symmetric key;
[0010] Obtaining a symmetric key and reference initial parameters for the first device, and generating an initialization vector based on the environment information and the reference initial parameters;
[0011] The second data is decrypted based on the reference initial parameter, the symmetric key, and the environmental information to obtain third data.
[0012] In a third aspect, an embodiment of the present application provides a data transmission device, the device comprising:
[0013] a transmission module, configured to obtain current environmental information and transmit the environmental information to a second device;
[0014] a vector generation module, configured to obtain a symmetric key and reference initial parameters for the second device, and generate an initialization vector based on the environment information and the reference initial parameters;
[0015] A data encryption module is used to encrypt the first data based on the symmetric key and the initialization vector to obtain second data, and send the second data to the second device, where the second data is used to instruct the second device to decrypt the second data based on the reference initial parameters, the symmetric key and the environmental information.
[0016] In a fourth aspect, an embodiment of the present application provides a data transmission device, the device comprising:
[0017] an information acquisition module, configured to acquire environmental information transmitted by a first device and receive second data sent by the first device;
[0018] a vector generation module, configured to obtain a symmetric key and reference initial parameters for the first device, and generate an initialization vector based on the environment information and the reference initial parameters;
[0019] The data decryption module is used to decrypt the second data based on the reference initial parameters, the symmetric key and the environmental information to obtain third data.
[0020] In a fifth aspect, an embodiment of the present application provides a computer storage medium, which stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the above-mentioned method steps.
[0021] In a sixth aspect, an embodiment of the present application provides an electronic device, which may include: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the above-mentioned method steps.
[0022] The beneficial effects of the technical solutions provided by some embodiments of the present application include at least:
[0023] In one or more embodiments of the present application, the first device can obtain the environmental information in which it is located and transmit the environmental information to the second device, and then obtain the symmetric key and reference initial parameters for the second device, and generate an initialization vector based on the environmental information and the reference initial parameters, so as to use the symmetric key and the initialization vector to encrypt the first data to obtain the second data, and finally send the second data to the second device; the entire data transmission process avoids using an increasing sequence and generates an initialization vector based on the environmental information, and at the same time does not directly transmit the initialization vector to the data recipient, thereby reducing the probability of device tracking during data transmission and improving the security of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0025] Figure 1 This is a flow chart of a data transmission method provided in an embodiment of the present application;
[0026] Figure 2 This is a flow chart of a data transmission method provided in an embodiment of the present application;
[0027] Figure 3 This is a schematic diagram of a data negotiation and transmission process provided by an embodiment of the present application;
[0028] Figure 4 This is a schematic diagram of a scenario of derivative processing provided by an embodiment of the present application;
[0029] Figure 5 This is a schematic diagram of a scenario of derivative processing provided by an embodiment of the present application;
[0030] Figure 6 This is a schematic diagram of a data encryption scenario involved in an embodiment of the present application;
[0031] Figure 7 This is a flow chart of a data transmission method provided in an embodiment of the present application;
[0032] Figure 8 This is a flow chart of a data transmission method provided in an embodiment of the present application;
[0033] Figure 9 This is a schematic diagram of a data transmission system according to an embodiment of the present application;
[0034] Figure 10This is a structural diagram of a data transmission device provided in an embodiment of the present application;
[0035] Figure 11 Schematic diagram of the structure of a vector generation module provided in an embodiment of the present application;
[0036] Figure 12 This is a structural diagram of a data transmission device provided in an embodiment of the present application;
[0037] Figure 13 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0038] Figure 14 This is a schematic diagram of the structure of the operating system and user space provided in an embodiment of the present application;
[0039] Figure 15 yes Figure 14 The architecture diagram of the Android operating system;
[0040] Figure 16 yes Figure 14 The architecture diagram of the IOS operating system;
[0041] Figure 17 This is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0042] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0043] In the description of this application, it should be understood that the terms "first", "second", etc. are used for descriptive purposes only and should not be understood to indicate or imply relative importance. In the description of this application, it should be noted that, unless otherwise expressly specified and limited, "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units inherent to these processes, methods, products or devices. For those of ordinary skill in the art, the specific meanings of the above terms in this application can be understood according to the specific circumstances. In addition, in the description of this application, unless otherwise specified, "multiple" refers to two or more. "and / or" describes the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.
[0044] The present application is described in detail below with reference to specific embodiments.
[0045] In one embodiment, Figure 1 As shown, a data transmission method is proposed. The method can be implemented by a computer program and can be run on a data transmission device based on the von Neumann architecture. The computer program can be integrated into an application or run as a standalone tool application. The data transmission device can be an electronic device, including but not limited to: a personal computer, a tablet computer, a handheld device, an in-vehicle device, a wearable device, a computing device, or other processing device connected to a wireless modem. Terminal devices can be called different names in different networks, such as user equipment, access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication device, user agent or user device, cellular phone, cordless phone, electronic device in 5G network or future evolution network, etc.
[0046] Specifically, the data transmission method includes:
[0047] S101: Acquire environmental information, and transmit the environmental information to a second device;
[0048] The environmental information can be understood as the first device in the current environment: altitude parameters of the environment, temperature parameters of the environment, humidity parameters of the environment, weather parameters of the environment, time parameters of the environment, magnetic parameters of the environment, etc.
[0049] It can be understood that when at least two devices are in a near-end communication scenario, data transmission usually involves the encryption transmission process of the corresponding data (business data), and the encryption transmission process involves the transmission of an initialization vector. The initialization vector and the symmetric key will be used to encrypt the corresponding data; further, the data receiver (such as the second device) also needs an initialization vector when decoding the data. In some near-end communication scenarios, a random increasing sequence is often used as the initialization vector, and then the data sender will first transmit the initialization vector in plain text to the data receiver before sending the encrypted data, so that the subsequent data receiver can decrypt the data.
[0050] It can be understood that in near-end communication scenarios other than mobile data networks, such as wireless Bluetooth communication, wireless near-field communication (NFC), ZigBee communication, etc., at least two devices participating in near-end communication are usually in the same environment. It can be understood that the data receiving end and the data sending end participating in the data transmission are in the same environment. In order to avoid being tracked by at least one third device (such as a monitoring device) located in the same environment when data transmission is encrypted, the data transmission method involved in this application is used. At least two devices participating in the data transmission do not transmit the initialization vector; in specific implementation, the initialization vector is usually sent from one end to the other end using a display transmission method, and the initialization vector is easily detected by the devices located in the same environment during the transmission process. The data is obtained by at least one third device, so that the third device can track the devices participating in the data transmission based on the random characteristics of the data of the initialization vector. (For example, in the counter mode, a random increasing sequence is often used as the initialization vector for plain text transmission. Usually, the initialization vector of each plain text transmission often presents a data increasing characteristic to the outside world. In the same environment, the initialization vector of each data sending device is usually different. For a certain data sending device, plain text transmission is continuously performed in a data increasing manner. This continuous data increasing characteristic will make the "certain data sending device" extremely easy to be tracked to related devices (such as the data sending end) by other devices in the same environment, and then the encrypted data involved in its data transmission is cracked).
[0051] In the present application, the third device in the same environment as the first device can easily obtain the initialization vector directly transmitted by the display transmission method. In order to avoid device tracking, the first device in the data transmission scenario may not use the above method to transmit the initialization vector; the data transmission method involved in the present application, the first device obtains the environmental information of the current environment and transmits the environmental information to the second device, so that the second device can decrypt the corresponding encrypted data in the subsequent encrypted data transmission scenario after obtaining the environmental information; in addition, since the environment information usually obtained by each device in the same environment (such as the first device, the second device, and the third device) is not directly transmitted, the first device in the data transmission scenario may not use the above method to transmit the initialization vector; the data transmission method involved in the present application, the first device obtains the environmental information of the current environment and transmits the environmental information to the second device, so that the second device can decrypt the corresponding encrypted data in the subsequent encrypted data transmission scenario; in addition, since the environment information usually obtained by each device in the same environment (such as the first device, the second device, and the third device) is not directly transmitted, the first device in the data transmission scenario may not use the above method to transmit the initialization vector; The information is highly similar, for example, at least one of "the altitude parameters of the environment, the temperature parameters of the environment, the humidity parameters of the environment, the weather parameters of the environment, the time parameters of the environment, the magnetic parameters of the environment, etc." is the same for each device in the same environment (for example, the time parameters are the same, the temperature and humidity parameters are the same, etc.). Based on this, even if the environmental information sent by any data sending device (such as the first device) to the data receiving device (the second device) before data transmission is obtained by other devices in the same environment (such as the third device), the third device cannot track the first device or the second device. It can be understood that since the environmental information obtained by the devices in the same environment are the same, the environmental information is transmitted using a display transmission method such as plain text transmission. Since the environmental information is the same, it can have a tracking confusing effect on other devices, making it impossible for other devices to track the current data transmission device (such as the first device, the second device) when the environmental information of all devices is the same. In addition, in the related art, especially in the counter mode, the initial value of the counter is usually predetermined as the initialization vector (the value subsequently generated based on the incrementing sequence is used as the initialization vector). Usually in the scenario of dividing and synchronizing cryptographic functionality, since the initialization vector is usually explicitly transmitted to the data receiving end, in order to avoid data leakage such as attacks, it is avoided to transmit the same initialization vector or select the initialization vector multiple times. Based on this, when the initialization vector is explicitly transmitted, the initialization vector will be different each time. The initialization vector is often generated in the form of the aforementioned incrementing sequence. In this application, the initialization vector is not directly transmitted to the second device but the environmental information is transmitted. In the actual application stage, it is not necessary to ensure that the environmental information is different each time. Even if the initialization vector generated based on the environmental information is the same each time, since the reference initial parameters are not visible to the outside, the third device cannot obtain the initialization vector even if it obtains the environmental information, thereby greatly saving the processing capacity of data transmission, improving the convenience and robustness of data transmission, and optimizing the data transmission process.
[0052] It can be understood that in the present application: environmental information may not be used directly as the initialization vector, but an initialization vector may be generated based on environmental information and reference initial parameters. The reference initial parameters are not visible to the outside world. The second device may use a display transmission method such as plain text transmission to transmit environmental information for negotiation before data transmission, so as to improve the security of data transmission and reduce the probability of device tracking.
[0053] S102: Acquire a symmetric key and reference initial parameters for the second device, and generate an initialization vector based on the environment information and the reference initial parameters.
[0054] The symmetric key can be understood as a derived symmetric key (K) generated by at least two devices (such as the first device and the second device) participating in data transmission based on a key derivation algorithm (KDF). The key derivation algorithm (KDF) can be SHA-256 algorithm, SM3 algorithm, Advanced Encryption Standard (AES), SM4 algorithm, Triple Data Encryption Standard (TDES), HKDF algorithm, etc.
[0055] It is understood that before data transmission, the first device and the second device may perform key negotiation: a key derivation algorithm (KDF) may be used to derive a symmetric key. This symmetric key can be considered a session key and used to encrypt session data (e.g., business data) between the communicating parties. In some embodiments, the symmetric key K can be derived from at least one shared key string and shared information of each participating communicating party based on a key derivation function corresponding to the key derivation algorithm.
[0056] The reference initial parameters are used to generate an initialization vector with the environment information. The reference initial parameters are not transmitted externally. In some embodiments, the first device and the second device may calculate the reference initial parameters (abcant) based on the negotiation data in the aforementioned symmetric key negotiation process. For example, the reference initial parameters may be calculated based on the shared information and shared key string of each communication end.
[0057] In one or more embodiments, the derivation may also be performed by a server, where the first device and the second device may send their respective shared information to the server, and the server then determines the shared key string and derives the symmetric key K based on the shared information of each end participating in the communication.
[0058] In one or more embodiments, after obtaining the reference initial parameters, the first device may perform function processing on the environmental information and the reference initial parameters using an objective function to obtain an initialization vector after the function processing.
[0059] Optionally, the target function method can be a customized function processing rule, or it can be a function processing rule and encryption processing rule involved in related technologies, etc. For example, the target function method can be a function processing method corresponding to an XOR function, an XOR function, a hash function, etc., which can be determined based on the actual application situation and is not specifically limited here.
[0060] In one or more embodiments, the first device may perform XOR processing on the environmental information and the reference initial parameter using an XOR function, that is, using the environmental information (such as the time parameter) and the reference initial parameter (abcant) as inputs for the XOR processing to obtain an initialization vector (abc) after the XOR processing;
[0061] In one or more embodiments, the first device may perform hash processing on the environmental information and the reference initial parameters using a hash function, that is, using the environmental information (such as time parameters) and the reference initial parameters (abcant) as inputs for hash processing to obtain the hashed initialization vector (abc).
[0062] S103: Encrypt the first data based on the symmetric key and the initialization vector to obtain second data, and send the second data to the second device, where the second data is used to instruct the second device to decrypt the second data based on the reference initial parameters, the symmetric key and the environmental information.
[0063] The first data may be understood as target data to be encrypted and sent by the first device to the second device. For example, the target data may be business data (such as business data atext).
[0064] It can be understood that the first device encrypts the first data based on the derived symmetric key and initialization vector to obtain the second data; the second data can be understood as the data to be transmitted generated after symmetric encryption; then the first device sends the encrypted second data to the second device through the communication connection between the first device and the second device.
[0065] For example, a Bluetooth communication connection may be established between the first device and the second device via a Bluetooth network, and the first device may send the second data to the second device based on the Bluetooth communication connection.
[0066] It can be understood that the first device can directly use a symmetric encryption method to symmetrically encrypt the source data (such as the first data) based on a symmetric key and an initialization vector to generate the second data; further, the symmetric encryption method refers to the sender and receiver of the encrypted information using the same symmetric key to encrypt / decrypt based on the initialization vector generated based on the environmental information.
[0067] Optionally, the algorithm based on the symmetric encryption method may be a DES encryption algorithm, a TripleDES encryption algorithm, an RC2 / RC4 / RC5 encryption algorithm, a Blowfish encryption algorithm, and the like.
[0068] In one or more embodiments, the first device and the second device implement secure transmission of business data based on symmetric encryption; after the second device receives the second data, the second device can decrypt the second data based on the reference initial parameters, the symmetric key and the environmental information transmitted by the first device to obtain decrypted third data, wherein the third data obtained by decrypting the second device data is usually the same as the first data.
[0069] It can be understood that for ordinary technicians in this field, the "embodiments involved in the data transmission method applied to the first device" and the "embodiments involved in the data transmission method applied to the second device" are generally independent embodiments; the terms such as environmental information, symmetric key, reference initial parameters, initialization vector, key context information, vector context information, etc. shown in the "embodiments involved in the data transmission method applied to the first device" and the terms such as environmental information, symmetric key, reference initial parameters, initialization vector, key context information, vector context information, etc. shown in the "embodiments involved in the data transmission method applied to the second device" are concepts with independent meanings. Usually, during the data transmission process, the terms such as environmental information, symmetric key, reference initial parameters, initialization vector, key context information, vector context information, etc. shown in the "embodiments involved in the data transmission method applied to the first device" have the same term data values as the corresponding terms such as environmental information, symmetric key, reference initial parameters, initialization vector, key context information, vector context information, etc. (with the same name) in the "embodiments involved in the data transmission method applied to the first device". For example, when the first device transmits the environmental information "aaaa..." to the second device, the second device will also receive the environmental information "aaaa...". At this time, although the first device and the second device both store the same environmental information and the values of the two environmental information are the same, they are two data stored independently in the first device and the second device respectively.
[0070] In an embodiment of the present application, the first device can obtain the environmental information in which it is located and transmit the environmental information to the second device, and then obtain the symmetric key and reference initial parameters for the second device, and generate an initialization vector based on the environmental information and the reference initial parameters, so as to use the symmetric key and the initialization vector to encrypt the first data to obtain the second data, and finally send the second data to the second device; the entire data transmission process avoids using an increasing sequence but generates an initialization vector based on the environmental information, and at the same time does not directly transmit the initialization vector to the data recipient, thereby reducing the probability of device tracking during data transmission and improving the security of data transmission.
[0071] See Figure 2 , Figure 2 This is a flow chart of another embodiment of a data transmission method proposed in this application. Specifically:
[0072] S201: Determine an environment information type from at least one reference information type, obtain environment information indicated by the environment information type, and transmit the environment information to a second device.
[0073] The reference information type may be an altitude parameter type, a temperature parameter type, a humidity parameter type, a weather parameter type, a magnetic parameter type, a time parameter type, and the like.
[0074] In one or more embodiments, since the first device and the second device in the same environment typically obtain the same environmental information, and the reference information types can be of multiple types, in order to improve the security of data transmission, during at least one round of data transmission, the first device can select an environmental information type from at least one reference information type to obtain the environmental information indicated by the environmental information type. It is understandable that when data transmission involves multiple rounds of conversation scenarios, the first device can use different reference information types during the data transmission process corresponding to at least one round of conversation scenarios, so as to use at least some different types of environmental information in each round of conversation scenarios to generate an initialization vector to improve the security of data transmission. It can be understood that in at least one round of conversation scenarios, the first device determines the environmental information type of the current session from at least one reference information type, and then the first device calls a specific function or a specific component to obtain the environmental information corresponding to the environmental information type. For example, the first device calls the time acquisition function to obtain the current time parameters, and the first device calls the magnetic sensor to obtain the magnetic parameters of the current environment.
[0075] It is understandable that after the first device obtains the environment information indicated by the environment information type, it can transmit the environment information to the second device based on the communication connection between the first device and the second device. Furthermore, the second device does not need to obtain the reference environment information in the current environment.
[0076] In one or more embodiments, since the first device and the second device in the same environment usually obtain the same environmental information, based on this, the first device can transmit the environmental information type to the second device to instruct the second device to obtain the environmental information indicated by the environmental information type; by sending the environmental information type corresponding to this round of data transmission, the intelligence of data transmission can be improved compared to directly sending the environmental information. The first device can selectively choose the corresponding data type to send, and at the same time, the data negotiation overhead before the data transmits the first data (such as business data) can be saved.
[0077] It can be understood that the first device can first obtain the current environmental information and transmit the environmental information type corresponding to the environmental information to the second device. The environmental information type is used to instruct the second device to obtain the reference environmental information corresponding to the information type. The reference environmental information is usually the same as the environmental information.
[0078] In some embodiments, the direct communication time between the first device and the second device is usually fast, and the first device and the second device are in the same environment (as if belonging to a near-end communication scenario). The information difference between the environmental information obtained by the first device and the reference environmental information obtained by the second device is usually small. The environmental information indicated by the corresponding information parameter accuracy can be obtained by setting the information parameter accuracy to offset the information difference, so that the reference environmental information is the same as the environmental information; taking the time of the environment in which the environmental information is located as an example, considering that the direct communication time between the two ends is short, the information parameter accuracy can be taken as precision seconds, and the obtained time parameter is in seconds.
[0079] Optionally, the first device may determine the environmental information type from at least one reference information type by randomly acquiring the type or by using a custom selection rule, which is determined based on an actual application environment and is not limited here.
[0080] S202: Acquire a shared key string and second shared information for the second device, where the second shared information is shared information transmitted by the second device to the first device;
[0081] It is understandable that before data transmission, the first device and the second device are involved in an encryption negotiation process; Figure 3 As shown, Figure 3 This is a schematic diagram of a data negotiation transmission process involved in this application. Figure 3In the process, the first device and the second device negotiate a shared key string (e.g., key string Z) based on a key agreement algorithm. The key agreement algorithm can be set based on the actual environment, for example, it can be based on the Diffie-Hellman algorithm, the RSA algorithm, the SM2 algorithm, etc. Taking the Diffie-Hellman algorithm as an example, the first device and the second device can use the Diffie-Hellman algorithm to create a key, i.e., a shared key string, through an insecure channel without any prior information between the communicating parties.
[0082] It can be understood that during the encryption negotiation process between the first device and the second device, the first device will send the first shared information (xif-A) to the second device; similarly, the second device will also send the second shared information (xif-B) to the first device.
[0083] The first shared information (xif-A) may be a random number generated by the first device, or may be service-related information corresponding to the first device, etc.
[0084] The second shared information (xif-B) may be a random number generated by the second device, or may be service-related information corresponding to the second device, etc.
[0085] It should be noted that the first shared information and the second shared information can usually be sent by the sending end to the other end using an explicit transmission method such as plain text transmission during the encryption negotiation process. The specific information content of the first shared information and the second shared information is determined based on the actual environment and is not limited here.
[0086] S203: Perform a first derivation process based on the key context information, the shared key string, first shared information, and second shared information to generate a symmetric key, where the first shared information is shared information transmitted from the first device to the second device;
[0087] The key context information can be understood as identification information for the symmetric key, and can be customized based on the actual application scenario and used to identify the symmetric key. For example, it can be one or more identification parameter types such as the name, meaning, purpose, specification, length, etc. used to identify the symmetric key, without specific limitation.
[0088] It is understood that in some implementation scenarios, key context information is determined prior to data transmission. In some embodiments, this is typically determined in advance by negotiation between the communicating parties. In some embodiments, context information used to identify a symmetric key is determined based on the initialization of a target functional service between the first and second devices, for example, the context information is set by the first device during service initialization prior to using the target functional service. In some embodiments, the first and second devices may also use a negotiation algorithm in related technologies to negotiate key context information, etc.
[0089] It can be understood that the first device performs a first derivation process based on the key context information, the shared key string, the first shared information and the second shared information to generate a symmetric key; schematically, as shown in FIG. Figure 4 As shown, Figure 4 This is a schematic diagram of a derivation process involved in this application. The first device can derive a symmetric key using a key derivation algorithm based on key context information, the shared key string, the first shared information, and the second shared information as algorithm inputs. The generation process of the symmetric key can be expressed as follows:
[0090] K=KDF1(Z,xif_A,xif_B,“wy”)
[0091] Among them, K is the symmetric key, Z is the shared key string, KDF1() is the first derivation process, xif_A is the first shared information, xif_B is the second shared information, and "wy" is the key context information.
[0092] S204: Perform a second derivation process based on the vector context information, the shared key string, the first shared information, and the second shared information to generate a reference initial parameter.
[0093] The vector context information ("abc") can be understood as identification information for the reference initial parameter (abcant), and can be customized based on the actual application scenario and used to identify the reference initial parameter (abcant). For example, it can be one or more of the identification parameter types such as the name, meaning, purpose, specification, length, etc. for identifying the reference initial parameter (abcant), and there is no specific limitation.
[0094] The key context information is different from the vector context information, that is, the key context information is different from the vector context information.
[0095] It is understandable that in some implementation scenarios, the vector context information is determined before data transmission. In some implementations, it is usually determined in advance by negotiation between the communicating parties. In some implementations, the context information used to identify the reference initial parameters (abcant) is determined when the target function service of the first device and the second device is initialized, for example, the context information set by the first device during the service initialization process before using the target function service. In some implementations, the first device and the second device may also use the vector context information negotiated by the negotiation algorithm in the relevant technology, and so on.
[0096] It can be understood that the first device performs a first derivation process based on the vector context information, the shared key string, the first shared information and the second shared information to generate a reference initial parameter; schematically, as shown in FIG. Figure 5 As shown, Figure 5 This is a schematic diagram of a derivation process involved in this application. The first device can derive a reference initial parameter using a key derivation algorithm based on vector context information, the shared key string, the first shared information, and the second shared information as algorithm inputs. The generation process of the reference initial parameter can be expressed as follows:
[0097] abcant=KDF2(Z,xif_A,xif_B,“abc”)
[0098] Among them, abcant is the reference initial parameter, Z is the shared key string, KDF2() is the second derivation process, xif_A is the first shared information, xif_B is the second shared information, and "abc" is the vector context information.
[0099] In one or more embodiments, the first device and the second device may perform information negotiation processing to generate key context information and vector context information; for example, the first device and the second device may jointly set key context information for identifying a symmetric key, or may jointly set vector context information for identifying reference initial parameters.
[0100] It can be understood that after completing the information negotiation process, the first device and the second device each save the key context information and the vector context information; the key context information is different from the vector context information.
[0101] S205: Determine a target function corresponding to the environmental information type based on a function mapping relationship between the at least one reference information type and a reference function;
[0102] The function mapping relationship is used to characterize the mapping between each reference information type and its corresponding reference function. In some embodiments, the function mapping relationship can be characterized in the form of a function mapping set, a function mapping table, a function mapping array, etc.
[0103] The reference function may be a corresponding function processing method such as an XOR function, an XNOR function, a hash function, etc., which may be determined based on actual application conditions and is not specifically limited here.
[0104] It can be understood that in this application, considering that environmental information can correspond to multiple reference information types, in order to improve the security of data transmission, the reference information type can be associated with the reference function used for subsequent generation of the initialization vector. It can be understood that by obtaining environmental information of different reference information types, different reference functions can be used when generating the initialization vector to improve the security of data transmission, reduce the possibility of device tracking, and ensure the security of data transmission.
[0105] It can be understood that by pre-setting a function mapping relationship between at least one reference information type and a reference function, after obtaining the environmental information corresponding to the environmental information type, the target function corresponding to the environmental information type can be determined in the function mapping relationship based on the environmental information type, so that the initialization vector can be determined based on the target function.
[0106] In one or more embodiments, the first device may generate an initialization vector by performing a function processing on the environment information and the reference initial parameters based on a default objective function (Func function). For example, the objective function may be an exclusive-OR function, and the environment information and the reference initial parameters are subjected to an exclusive-OR calculation to obtain the initialization vector.
[0107] S206: Performing function processing on the environmental information and the reference initial parameters using the objective function to obtain an initialization vector after function processing.
[0108] In one or more embodiments, after obtaining the reference initial parameters, the first device may perform function processing on the environmental information and the reference initial parameters using an objective function to obtain an initialization vector after the function processing.
[0109] Optionally, the target function method can be a customized function processing rule, or it can be a function processing rule and encryption processing rule involved in related technologies, etc. For example, the target function method can be a function processing method corresponding to an XOR function, an XOR function, a hash function, etc., which can be determined based on the actual application situation and is not specifically limited here.
[0110] In one or more embodiments, the first device may perform XOR processing on the environmental information and the reference initial parameter using an XOR function, that is, using the environmental information (such as the time parameter) and the reference initial parameter (abcant) as inputs for the XOR processing to obtain an initialization vector (abc) after the XOR processing;
[0111] In one or more embodiments, the first device may perform hash processing on the environmental information and the reference initial parameters using a hash function, that is, using the environmental information (such as time parameters) and the reference initial parameters (abcant) as inputs for hash processing to obtain the hashed initialization vector (abc).
[0112] In a specific implementation scenario, taking a time series parameter in which environmental information is a time parameter type as an example. During at least one round of data transmission, the first device and the second device are in a target mode (such as a calculator mode such as CTR or GCM). The first device calculates the target function using the reference initial parameters in combination with the time series t obtained in each round to obtain an initialization vector abc. The first data (such as business data atext) is symmetrically encrypted (Encrypted) using the symmetric key K in combination with the initialization vector abc to obtain the second data (such as ciphertext ctext), as follows:
[0113] The first round of data transmission:
[0114] abc_1=Func(abcant,t_1)
[0115] Where abc_1 is the initialization vector calculated in the first round of data transmission, abcant is the reference initial parameter, t_1 is the time parameter obtained in the first round of data transmission; Func() is the objective function.
[0116] ctext_1=Encrypt(K,abc_1,atext_1)
[0117] Wherein, ctext_1 is the second data after encryption in the first round of data transmission, atext_1 is the first data in the first round of data transmission (which can be understood as the source data), and K is the symmetric key;
[0118] Second round of data transmission:
[0119] abc_2=Func(abcant,t_2)
[0120] Where abc_2 is the initialization vector calculated for the second round of data transmission, abcant is the reference initial parameter, t_2 is the time parameter obtained during the second round of data transmission; Func() is the objective function;
[0121] ctext_2=Encrypt(K,abc_2,atext_2)
[0122] Wherein, ctext_2 is the second data after encryption in the second round of data transmission, atext_2 is the first data in the second round of data transmission (which can be understood as the source data), and K is the symmetric key; ......
[0124] The i-th round of data transmission:
[0125] abc_i=Func(abcant,t_i)
[0126] Among them, abc_i is the initialization vector calculated for the i-th round of data transmission, abcant is the reference initial parameter, t_i is the time parameter obtained during the i-th round of data transmission; Func() is the objective function
[0127] ctext_i=Encrypt(K,abc_i,atext_i)
[0128] Wherein, ctext_i is the second data after encryption in the i-th round of data transmission, atext_i is the first data in the i-th round of data transmission (which can be understood as the source data), and K is the symmetric key;
[0129] S207: Encrypt the first data based on the symmetric key and the initialization vector to obtain second data, and send the second data to the second device.
[0130] Understandably, Figure 6 As shown, Figure 6 This is a schematic diagram of a data encryption scenario involved in an embodiment of the present application. After generating an initialization vector, the first data can be encrypted based on the symmetric key k and the initialization vector abc to generate encrypted second data.
[0131] It can be understood that for ordinary technicians in this field, the "embodiments involved in the data transmission method applied to the first device" and the "embodiments involved in the data transmission method applied to the second device" are generally independent embodiments; the terms such as environmental information, symmetric key, reference initial parameters, initialization vector, key context information, vector context information, etc. shown in the "embodiments involved in the data transmission method applied to the first device" and the terms such as environmental information, symmetric key, reference initial parameters, initialization vector, key context information, vector context information, etc. shown in the "embodiments involved in the data transmission method applied to the second device" are concepts with independent meanings. Usually, during the data transmission process, the terms such as environmental information, symmetric key, reference initial parameters, initialization vector, key context information, vector context information, etc. shown in the "embodiments involved in the data transmission method applied to the first device" have the same term data values as the corresponding terms such as environmental information, symmetric key, reference initial parameters, initialization vector, key context information, vector context information, etc. (with the same name) in the "embodiments involved in the data transmission method applied to the first device".
[0132] In an embodiment of the present application, the first device can obtain the environmental information in which it is located and transmit the environmental information to the second device, then obtain the symmetric key and reference initial parameters for the second device, and generate an initialization vector based on the environmental information and the reference initial parameters, so as to use the symmetric key and the initialization vector to encrypt the first data to obtain the second data, and finally send the second data to the second device; the entire data transmission process avoids using an increasing sequence but generates an initialization vector based on the environmental information, and at the same time does not directly transmit the initialization vector to the data recipient, thereby reducing the probability of device tracking during data transmission and improving the security of data transmission; and, different environmental information types can be selected from multiple reference information types in at least one round of conversation scenarios to obtain environmental information, which can improve the security of data transmission; and only the environmental information type can be sent to the second device to instruct the second device to obtain the corresponding environmental information, thereby improving the convenience of data transmission and saving the overhead of data transmission.
[0133] In one embodiment, Figure 7As shown, a data transmission method is proposed. The method can be implemented by a computer program and can be run on a data transmission device based on the von Neumann architecture. The computer program can be integrated into an application or run as a standalone tool application. The data transmission device can be an electronic device, including but not limited to: a personal computer, a tablet computer, a handheld device, an in-vehicle device, a wearable device, a computing device, or other processing device connected to a wireless modem. Terminal devices can be called different names in different networks, such as user equipment, access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication device, user agent or user device, cellular phone, cordless phone, electronic device in 5G network or future evolution network, etc.
[0134] Specifically, the data transmission method includes:
[0135] S301: Acquire environmental information transmitted by a first device, and receive second data sent by the first device; the second data is generated by encrypting the first data based on an initialization vector and a symmetric key;
[0136] In one or more embodiments, the environmental information is the environmental information obtained by the first device. The environmental information can be understood as the following in the current environment: altitude parameters of the environment, temperature parameters of the environment, humidity parameters of the environment, weather parameters of the environment, time parameters of the environment, magnetic parameters of the environment, etc.
[0137] In one or more embodiments, the first device obtains information about its environment and sends the information to the second device. The second device can receive the information based on the communication connection with the first device. It is understood that the information is used by the second device to decrypt the second data.
[0138] In one or more embodiments, the first device obtains a symmetric key and reference initial parameters for the second device, generates an initialization vector based on the environmental information and the reference initial parameters, and then encrypts the first data based on the symmetric key and the initialization vector to obtain second data, and sends the second data to the second device; at this time, the second device can receive the second data sent by the first device based on the communication connection between the second device and the first device.
[0139] S302: Acquire a symmetric key and reference initial parameters for the first device, and generate an initialization vector based on the environment information and the reference initial parameters;
[0140] It is understandable that before data transmission, the second device can perform key negotiation with the first device: a key derivation algorithm (KDF) is used to derive a symmetric key, which can be regarded as a session key for encrypting session data (such as business data) between the communication ends. In some embodiments, a symmetric key K can be derived from at least one shared key string and shared information of each end participating in the communication based on a key derivation function corresponding to the key derivation algorithm. The key derivation algorithm (KDF) can be SHA-256 algorithm, SM3 algorithm, Advanced Encryption Standard (AES), SM4 algorithm, Triple Data Encryption Standard (TDES), HKDF algorithm, etc.
[0141] The reference initial parameters are used to generate an initialization vector (IV) with the environmental information, facilitating subsequent data decryption by the second device based on the VIV. For both communicating parties, the reference initial parameters are not transmitted externally; the first and second devices each calculate the reference initial parameters. In some embodiments, the first and second devices can calculate the reference initial parameters (abcant) based on the negotiated data from the aforementioned symmetric key negotiation process. For example, the reference initial parameters can be calculated based on shared information and a shared key string between the communicating parties.
[0142] In one or more embodiments, after obtaining the reference initial parameters, the second device may use an objective function to perform function processing on the environmental information and the reference initial parameters to obtain an initialization vector after function processing.
[0143] Optionally, the target function method can be a customized function processing rule, or it can be a function processing rule and encryption processing rule involved in related technologies, etc. For example, the target function method can be a function processing method corresponding to an XOR function, an XOR function, a hash function, etc., which can be determined based on the actual application situation and is not specifically limited here.
[0144] In one or more embodiments, the second device may perform hash processing on the environmental information and the reference initial parameters using a hash function, that is, using the environmental information (such as time parameters) and the reference initial parameters (abcant) as inputs for hash processing to obtain the hashed initialization vector (abc).
[0145] S303: Decrypt the second data based on the reference initial parameters, the symmetric key, and the environmental information to obtain third data.
[0146] It can be understood that decrypting the second data can be understood as the reverse process of “encrypting the first data”.
[0147] As can be understood, the first device encrypts the first data using a derived symmetric key and initialization vector to obtain the second data; the second data can be understood as the data to be transmitted after the symmetric encryption. The first device then sends the encrypted second data to the second device via the communication connection between the first device and the second device. The decryption process is as follows: the second device decrypts the second data using the derived symmetric key and initialization vector to obtain the third data; the third data can be understood as the data generated after the decryption. The third data obtained by the second device is generally the same as the first data.
[0148] For example, a Bluetooth communication connection may be established between the first device and the second device via a Bluetooth network, and the second device may receive the second data based on the Bluetooth communication connection.
[0149] It can be understood that the second device directly adopts the inverse process corresponding to the symmetric encryption method, the "symmetric decryption method", to symmetrically decrypt the second data based on the symmetric key and the initialization vector to generate the third data; further, the symmetric decryption method is the inverse process of the symmetric encryption method: because the sender and receiver of the encrypted information use the same symmetric key to decrypt based on the initialization vector generated based on the environmental information.
[0150] Optionally, the algorithm based on the symmetric decryption method may be a decryption method corresponding to the DES encryption algorithm, a decryption method corresponding to the TripleDES encryption algorithm, a decryption method corresponding to the RC2 / RC4 / RC5 encryption algorithm, a decryption method corresponding to the Blowfish encryption algorithm, and the like.
[0151] It can be understood that for ordinary technicians in this field, the "embodiments involved in the data transmission method applied to the first device" and the "embodiments involved in the data transmission method applied to the second device" are generally independent embodiments; the terms such as environmental information, symmetric key, reference initial parameters, initialization vector, key context information, vector context information, etc. shown in the "embodiments involved in the data transmission method applied to the first device" and the terms such as environmental information, symmetric key, reference initial parameters, initialization vector, key context information, vector context information, etc. shown in the "embodiments involved in the data transmission method applied to the second device" are concepts with independent meanings. Usually, during the data transmission process, the terms such as environmental information, symmetric key, reference initial parameters, initialization vector, key context information, vector context information, etc. shown in the "embodiments involved in the data transmission method applied to the first device" have the same term data values as the corresponding terms such as environmental information, symmetric key, reference initial parameters, initialization vector, key context information, vector context information, etc. (with the same name) in the "embodiments involved in the data transmission method applied to the first device". For example, when the first device transmits the environmental information "aaaa..." to the second device, the second device will also receive the environmental information "aaaa...". At this time, although the first device and the second device both store the same environmental information and the values of the two environmental information are the same, they are two data stored independently in the first device and the second device respectively.
[0152] In an embodiment of the present application, the second device can obtain the environmental information transmitted by the first device. After receiving the second data sent by the first device, by obtaining the symmetric key and reference initial parameters for the first device, the second device can generate an initialization vector based on the environmental information and the reference initial parameters, thereby decrypting the second data based on the reference initial parameters, the symmetric key and the environmental information to obtain the third data; the entire data transmission process and the data decryption process avoid using an increasing sequence but generate an initialization vector based on the environmental information, and at the same time do not directly transmit the initialization vector to the data recipient, thereby reducing the probability of device tracking during data transmission and improving the security of data transmission; and, different environmental information types can be selected from multiple reference information types in at least one round of conversation scenarios to obtain environmental information, which can improve the security of data transmission; and only the environmental information type can be sent to the second device to instruct the second device to obtain the corresponding environmental information, thereby improving the convenience of data transmission and saving the overhead of data transmission.
[0153] See Figure 8 , Figure 8 This is a flow chart of another embodiment of a data transmission method proposed in this application. Specifically:
[0154] S401: Receive an environment information type transmitted by a first device, where the environment information type is a type corresponding to the environment information acquired by the first device.
[0155] According to some embodiments, the first device may determine the environmental information type from at least one reference information type; or, the first device may be set with a default environmental information type; and then send the environmental information type to the second device; the second device may receive the environmental information type based on the communication connection between the first device and the first device.
[0156] It can be understood that the environmental information type can be a fit of one or more types such as altitude parameter type, temperature parameter type, humidity parameter type, weather parameter type, magnetic parameter type, and time parameter type.
[0157] S402: Acquire reference environment information corresponding to the environment information type, and use the reference environment information as the environment information;
[0158] In one or more embodiments, since the first device and the second device in the same environment typically obtain the same environmental information, and the reference information types can be of multiple types, in order to improve the security of data transmission, during at least one round of data transmission, the first device can select one environmental information type from at least one reference information type to obtain the environmental information indicated by the environmental information type. It is understandable that when data transmission involves multiple rounds of conversation scenarios, the first device can use different reference information types during the data transmission process corresponding to at least one round of conversation scenarios, so as to use at least some different types of environmental information in each round of conversation scenarios to generate an initialization vector to improve the security of data transmission. It is understandable that in at least one round of conversation scenarios, after receiving the environmental information type sent by the first device, the second device can call a specific function or a specific component to obtain the reference environmental information corresponding to the environmental information type, thereby using the reference environmental information as the environmental information obtained by the first device to facilitate subsequent decryption of the second data. For example, the second device calls the time acquisition function to obtain the current time parameters, and the second device calls the magnetic sensor to obtain the magnetic parameters of the current environment.
[0159] In one or more embodiments, since the first device and the second device in the same environment usually obtain the same environmental information, based on this, the first device can transmit the environmental information type to the second device to instruct the second device to obtain the reference environmental information indicated by the environmental information type as the environmental information obtained by the first device; by receiving the environmental information type corresponding to the current round of data transmission by the first device, the intelligence of the data transmission can be improved compared to the first device directly sending the environmental information, and at the same time, the data negotiation overhead before the data transmits the first data (such as business data) can be saved.
[0160] S403: Receive second data sent by the first device; the second data is generated by encrypting the first data based on the initialization vector and the symmetric key.
[0161] For details, please refer to the method steps involved in other embodiments of the present application, which will not be repeated here.
[0162] S404: Acquire a shared key string and first shared information for the first device, where the first shared information is shared information transmitted by the first device to the second device;
[0163] It is understandable that before data transmission, the first device and the second device are involved in an encryption negotiation process; Figure 3 As shown, Figure 3 This is a schematic diagram of a data negotiation transmission process involved in this application. Figure 3 In the process, the first device and the second device negotiate a shared key string (e.g., key string Z) based on a key agreement algorithm. The key agreement algorithm can be set based on the actual environment, for example, it can be based on the Diffie-Hellman algorithm, the RSA algorithm, the SM2 algorithm, etc. Taking the Diffie-Hellman algorithm as an example, the first device and the second device can use the Diffie-Hellman algorithm to create a key, i.e., a shared key string, through an insecure channel without any prior information between the communicating parties.
[0164] It can be understood that during the encryption negotiation process between the first device and the second device, the first device will send the first shared information (xif-A) to the second device; similarly, the second device will also send the second shared information (xif-B) to the first device.
[0165] The first shared information (xif-A) may be a random number generated by the first device, or may be service-related information corresponding to the first device, etc.
[0166] The second shared information (xif-B) may be a random number generated by the second device, or may be service-related information corresponding to the second device, etc.
[0167] It should be noted that the first shared information and the second shared information can usually be sent by the sending end to the other end using an explicit transmission method such as plain text transmission during the encryption negotiation process. The specific information content of the first shared information and the second shared information is determined based on the actual environment and is not limited here.
[0168] The key context information can be understood as identification information for the symmetric key, and can be customized based on the actual application scenario and used to identify the symmetric key. For example, it can be one or more identification parameter types such as the name, meaning, purpose, specification, length, etc. used to identify the symmetric key, without specific limitation.
[0169] It is understood that in some implementation scenarios, key context information is determined prior to data transmission. In some embodiments, this is typically determined in advance by negotiation between the communicating parties. In some embodiments, context information used to identify a symmetric key is determined based on the initialization of a target functional service between the first and second devices, for example, the context information is set by the first device during service initialization prior to using the target functional service. In some embodiments, the first and second devices may also use a negotiation algorithm in related technologies to negotiate key context information, etc.
[0170] It can be understood that the first device performs a first derivation process based on the key context information, the shared key string, the first shared information and the second shared information to generate a symmetric key; schematically, as shown in FIG. Figure 4 As shown, Figure 4 This is a schematic diagram of a derivation process involved in this application. The first device can derive a symmetric key using a key derivation algorithm based on key context information, the shared key string, the first shared information, and the second shared information as algorithm inputs. The generation process of the symmetric key can be expressed as follows:
[0171] K=KDF1(Z,xif_A,xif_B,“wy”)
[0172] Among them, K is the symmetric key, Z is the shared key string, KDF1() is the first derivation process, xif_A is the first shared information, xif_B is the second shared information, and "wy" is the key context information.
[0173] S405: Perform a second derivation process based on the key context information, the shared key string, second shared information, and the first shared information to generate a symmetric key, where the second shared information is shared information transmitted by the second device to the first device.
[0174] The key context information can be understood as identification information for the symmetric key, and can be customized based on the actual application scenario and used to identify the symmetric key. For example, it can be one or more identification parameter types such as the name, meaning, purpose, specification, length, etc. used to identify the symmetric key, without specific limitation.
[0175] It is understood that in some implementation scenarios, key context information is determined prior to data transmission. In some embodiments, this is typically determined in advance by negotiation between the communicating parties. In some embodiments, context information used to identify a symmetric key is determined based on the initialization of a target functional service between the first and second devices, for example, the context information is set by the first device during service initialization prior to using the target functional service. In some embodiments, the first and second devices may also use a negotiation algorithm in related technologies to negotiate key context information, etc.
[0176] It can be understood that the first device performs a first derivation process based on the key context information, the shared key string, the first shared information and the second shared information to generate a symmetric key; schematically, as shown in FIG. Figure 4 As shown, Figure 4 This is a schematic diagram of a derivation process involved in this application. The first device can derive a symmetric key using a key derivation algorithm based on key context information, the shared key string, the first shared information, and the second shared information as algorithm inputs. The generation process of the symmetric key can be expressed as follows:
[0177] K=KDF1(Z,xif_A,xif_B,“wy”)
[0178] Among them, K is the symmetric key, Z is the shared key string, KDF1() is the first derivation process, xif_A is the first shared information, xif_B is the second shared information, and "wy" is the key context information.
[0179] S406: Perform a first derivation process based on the vector context information, the shared key string, the second shared information, and the first shared information to generate a reference initial parameter.
[0180] The vector context information ("abc") can be understood as identification information for the reference initial parameter (abcant), and can be customized based on the actual application scenario and used to identify the reference initial parameter (abcant). For example, it can be one or more of the identification parameter types such as the name, meaning, purpose, specification, length, etc. for identifying the reference initial parameter (abcant), and there is no specific limitation.
[0181] The key context information is different from the vector context information, that is, the key context information is different from the vector context information.
[0182] It is understandable that in some implementation scenarios, the vector context information is determined before data transmission. In some implementations, it is usually determined in advance by negotiation between the communicating parties. In some implementations, the context information used to identify the reference initial parameters (abcant) is determined when the target function service of the first device and the second device is initialized, for example, the context information set by the second device during the service initialization process before using the target function service. In some implementations, the first device and the second device may also use the vector context information negotiated by the negotiation algorithm in the relevant technology, and so on.
[0183] It can be understood that the second device performs a first derivation process based on the vector context information, the shared key string, the first shared information and the second shared information to generate a reference initial parameter; schematically, as shown in FIG. Figure 5 As shown, Figure 5 This is a schematic diagram of a derivation process involved in this application. The second device can derive a reference initial parameter using a key derivation algorithm based on the vector context information, the shared key string, the first shared information, and the second shared information as algorithm inputs. The generation process of the reference initial parameter can be expressed as follows:
[0184] abcant=KDF2(Z,xif_A,xif_B,“abc”)
[0185] Among them, abcant is the reference initial parameter, Z is the shared key string, KDF2() is the second derivation process, xif_A is the first shared information, xif_B is the second shared information, and "abc" is the vector context information.
[0186] In one or more embodiments, the second device may perform information negotiation processing with the first device to generate key context information and vector context information; for example, the first device and the second device jointly set key context information to identify a symmetric key, and for example, the first device and the second device jointly set vector context information to identify reference initial parameters.
[0187] It can be understood that after completing the information negotiation process, the second device and the first device each save the key context information and the vector context information; the key context information is different from the vector context information.
[0188] S407: Generate an initialization vector based on the environment information and the reference initial parameters.
[0189] In one or more embodiments, the first device can determine the target function corresponding to the environmental information type based on the function mapping relationship between the at least one reference information type and the reference function, so as to obtain the initialization vector by using the target function; based on this, the second device can save the function mapping relationship between at least one reference information type and the reference function, so as to determine the target function corresponding to the environmental information type, and use the target function to obtain the initialization vector involved in the data encryption of the first device.
[0190] In one or more embodiments, the target function may also be a default setting of the first device and the second device. The second device may use the target function to perform function processing on the environmental information and the reference initial parameters to obtain the initialization vector after function processing.
[0191] S408: Decrypt the second data based on the reference initial parameters, the symmetric key, and the environmental information to obtain third data.
[0192] For details, please refer to the method steps of other embodiments involved in this application, which will not be repeated here.
[0193] It can be understood that for ordinary technicians in this field, the "embodiments involved in the data transmission method applied to the first device" and the "embodiments involved in the data transmission method applied to the second device" are generally independent embodiments; the terms such as environmental information, symmetric key, reference initial parameters, initialization vector, key context information, vector context information, etc. shown in the "embodiments involved in the data transmission method applied to the first device" and the terms such as environmental information, symmetric key, reference initial parameters, initialization vector, key context information, vector context information, etc. shown in the "embodiments involved in the data transmission method applied to the second device" are concepts with independent meanings. Usually, during the data transmission process, the terms such as environmental information, symmetric key, reference initial parameters, initialization vector, key context information, vector context information, etc. shown in the "embodiments involved in the data transmission method applied to the first device" have the same term data values as the corresponding terms such as environmental information, symmetric key, reference initial parameters, initialization vector, key context information, vector context information, etc. (with the same name) in the "embodiments involved in the data transmission method applied to the first device". For example, when the first device transmits the environmental information "aaaa..." to the second device, the second device will also receive the environmental information "aaaa...". At this time, although the first device and the second device both store the same environmental information and the values of the two environmental information are the same, they are two data stored independently in the first device and the second device respectively.
[0194] In an embodiment of the present application, the second device can obtain the environmental information transmitted by the first device. After receiving the second data sent by the first device, by obtaining the symmetric key and reference initial parameters for the first device, the second device can generate an initialization vector based on the environmental information and the reference initial parameters, thereby decrypting the second data based on the reference initial parameters, the symmetric key and the environmental information to obtain the third data; the entire data transmission process and the data decryption process avoid using an increasing sequence but generate an initialization vector based on the environmental information, and at the same time do not directly transmit the initialization vector to the data recipient, thereby reducing the probability of device tracking during data transmission and improving the security of data transmission; and, different environmental information types can be selected from multiple reference information types in at least one round of conversation scenarios to obtain environmental information, which can improve the security of data transmission; and only the environmental information type can be sent to the second device to instruct the second device to obtain the corresponding environmental information, thereby improving the convenience of data transmission and saving the overhead of data transmission.
[0195] See Figure 9 , is a schematic diagram of a scenario of a data transmission system provided in an embodiment of the present application. Figure 9 As shown, the data transmission system may include a first device 100 and a second device 110 .
[0196] The first device 100 and the second device 110 may be electronic devices, including but not limited to wearable devices, handheld devices, personal computers, tablet computers, vehicle-mounted devices, computing devices, or other processing devices connected to a wireless modem. In different networks, user terminals may be called different names, such as user equipment, access terminal, subscriber unit, subscriber station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication device, user agent or user device, cellular phone, cordless phone, personal digital assistant (PDA), devices in 5G network or future evolution network, etc.
[0197] The first device 100 can interact with the second device 110 through a communication network, which can be a near-end communication network other than a mobile data network, such as a wireless Bluetooth communication network, a wireless near field communication (NFC) network, or a ZigBee communication network.
[0198] The first device 100 and the second device 110 are usually in the same environment. During the data transmission process, in order to avoid being tracked by at least one third device (such as a monitoring device) located in the same environment, the first device 100 and the second device 110 participating in the data transmission using the data transmission method involved in the present application do not involve the transmission of an initialization vector. It can be understood that the initialization vector does not use a random increasing sequence corresponding to a random number, so as to avoid the third device from tracking the device participating in the data transmission based on the random characteristics of the data of the initialization vector (such as the commonly used use of a random increasing sequence as an initialization vector for plain text transmission. Usually, the initialization vector of each plain text transmission often presents a data increasing characteristic to the outside world. However, the initialization vector of each data sending device in the same environment is different. Continuously transmitting plain text in an increasing manner for a certain data sending device will make it extremely easy for other devices in the same environment to track the related device based on the data increasing characteristic, and then crack the data involved in its data transmission).
[0199] It can be understood that the data transmission system and the data transmission method provided in the above embodiments belong to the same concept, and their implementation process is detailed in the method embodiment, which will not be repeated here.
[0200] The following will be combined Figure 10 , the data transmission device provided in the embodiment of the present application is introduced in detail. It should be noted that, Figure 10 The data transmission device shown is used to execute the methods of one or more embodiments involved in this application. For the sake of convenience, only the parts related to the embodiments of this application are shown. For specific technical details not disclosed, please refer to one or more method embodiments involved in this application.
[0201] See Figure 10 , which shows a schematic diagram of the structure of a data transmission device according to an embodiment of the present application. The data transmission device 1 can be implemented as all or part of a user terminal through software, hardware, or a combination of both. According to some embodiments, the data transmission device 1 includes an information transmission module 11, a vector generation module 12, and a data encryption module 13, which are specifically used to:
[0202] An information transmission module 11 is configured to obtain current environmental information and transmit the environmental information to a second device;
[0203] a vector generation module 12, configured to obtain a symmetric key and reference initial parameters for the second device, and generate an initialization vector based on the environment information and the reference initial parameters;
[0204] A data encryption module 13 is configured to encrypt the first data based on the symmetric key and the initialization vector to obtain second data, and send the second data to the second device, wherein the second data is used to instruct the second device to decrypt the second data based on the reference initial parameters, the symmetric key, and the environmental information.
[0205] Optional, such as Figure 11 As shown, the vector generation module 12 includes:
[0206] An information acquisition unit 121 is configured to acquire a shared key string and second shared information for the second device, where the second shared information is shared information transmitted by the second device to the first device;
[0207] a key generation unit 122, configured to perform a first derivation process based on the key context information, the shared key string, first shared information, and second shared information to generate a symmetric key, where the first shared information is shared information transmitted from the first device to the second device;
[0208] The parameter generating unit 123 is configured to perform a second derivation process based on the vector context information, the shared key string, the first shared information, and the second shared information to generate reference initial parameters.
[0209] Optionally, the device 1 is specifically used for:
[0210] Performing information negotiation with the second device to generate key context information and vector context information;
[0211] The key context information and the vector context information are saved; the key context information is different from the vector context information.
[0212] Optionally, the vector generation module 12 is specifically configured to:
[0213] The environmental information and the reference initial parameters are processed by a target function to obtain an initialization vector after the function processing.
[0214] Optionally, the vector generation module 12 is specifically configured to:
[0215] Performing XOR processing on the environmental information and the reference initial parameter using an XOR function to obtain an XOR-processed initialization vector; or,
[0216] A hash function is used to perform hash processing on the environmental information and the reference initial parameters to obtain a hashed initialization vector.
[0217] Optionally, the transmission module 11 is specifically configured to:
[0218] Acquire current environmental information, and transmit an environmental information type corresponding to the environmental information to the second device, wherein the environmental information type is used to instruct the second device to acquire reference environmental information corresponding to the information type, and the reference environmental information is the same as the environmental information.
[0219] Optionally, the transmission module 11 is specifically configured to:
[0220] An environmental information type is determined from at least one reference information type, and environmental information indicated by the environmental information type is acquired.
[0221] Optionally, the transmission module 11 is specifically configured to:
[0222] Determining a target function mode corresponding to the environment information type based on a function mapping relationship between the at least one reference information type and a reference function mode;
[0223] The environmental information and the reference initial parameters are processed by the objective function to obtain an initialization vector after the function processing.
[0224] It should be noted that the data transmission device provided in the above embodiment, when executing the data transmission method, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the data transmission device provided in the above embodiment and the data transmission method embodiment are based on the same concept. The implementation process is detailed in the method embodiment and will not be repeated here.
[0225] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0226] See Figure 12 , which shows a schematic diagram of the structure of the data transmission device of an embodiment of the present application. The data transmission device 2 can be implemented as all or part of the user terminal through software, hardware, or a combination of both. According to some embodiments, the data transmission device 2 includes an information acquisition module 21, a vector generation module 22, and a data decryption module 23, which are specifically used to:
[0227] An information acquisition module 21 is configured to acquire environmental information transmitted by a first device and receive second data sent by the first device;
[0228] a vector generation module 22, configured to obtain a symmetric key and reference initial parameters for the first device, and generate an initialization vector based on the environment information and the reference initial parameters;
[0229] The data decryption module 23 is configured to decrypt the second data based on the reference initial parameters, the symmetric key, and the environmental information to obtain third data.
[0230] Optionally, the vector generation module 22 is specifically configured to:
[0231] Obtaining a shared key string and first shared information for the first device, where the first shared information is shared information transmitted by the first device to the second device;
[0232] performing a second derivation process based on the key context information, the shared key string, second shared information, and the first shared information to generate a symmetric key, where the second shared information is shared information transmitted by the second device to the first device;
[0233] A first derivation process is performed based on the vector context information, the shared key string, the second shared information, and the first shared information to generate a reference initial parameter.
[0234] Optionally, the vector generation module 22 is specifically configured to:
[0235] Performing information negotiation with the first device to generate key context information and vector context information;
[0236] The key context information and the vector context information are saved; the key context information is different from the vector context information.
[0237] Optionally, the vector generation module 22 is specifically configured to:
[0238] The environmental information and the reference initial parameters are processed using an objective function to obtain an initialization vector after the function processing.
[0239] Optionally, the information acquisition module 21 is specifically configured to:
[0240] receiving an environment information type transmitted by the first device, where the environment information type is a type corresponding to the environment information acquired by the first device;
[0241] Acquire reference environment information corresponding to the environment information type, and use the reference environment information as the environment information.
[0242] Optionally, the vector generation module 22 is specifically configured to:
[0243] determining a target function corresponding to the environmental information type based on a function mapping relationship between the at least one reference information type and a reference function;
[0244] The objective function is used to perform function processing on the environmental information and the reference initial parameters to obtain an initialization vector after function processing.
[0245] It should be noted that the data transmission device provided in the above embodiment, when executing the data transmission method, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the data transmission device provided in the above embodiment and the data transmission method embodiment are based on the same concept. The implementation process is detailed in the method embodiment and will not be repeated here.
[0246] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0247] The present application also provides a computer storage medium that can store multiple instructions, which are suitable for being loaded and executed by a processor as described above. Figures 1 to 9 The data transmission method of the embodiment shown in the figure can be found in the specific execution process. Figures 1 to 9 The detailed description of the illustrated embodiment will not be repeated here.
[0248] The present application also provides a computer program product, which stores at least one instruction, and the at least one instruction is loaded and executed by the processor as described above. Figures 1 to 9 The data transmission method of the embodiment shown in the figure can be found in the specific execution process. Figures 1 to 9 The detailed description of the illustrated embodiment will not be repeated here.
[0249] Please refer to Figure 13 , which shows a block diagram of the structure of an electronic device provided by an exemplary embodiment of the present application. The electronic device in the present application may include one or more of the following components: a processor 1100, a memory 120, an input device 130, an output device 140, and a bus 150. The processor 1100, the memory 120, the input device 130, and the output device 140 may be connected via the bus 150.
[0250] The processor 1100 may include one or more processing cores. The processor 1100 utilizes various interfaces and circuits to connect various components within the electronic device. It executes instructions, programs, code sets, or instruction sets stored in the memory 120, as well as accesses data stored in the memory 120, to perform various functions of the electronic device and process data. Optionally, the processor 1100 may be implemented using at least one of the following hardware forms: a digital signal processing (DSP), a field-programmable gate array (FPGA), or a programmable logic array (PLA). The processor 1100 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. The CPU primarily handles the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem handles wireless communications. It is understood that the modem may not be integrated into the processor 1100 and may be implemented separately via a communications chip.
[0251] The memory 120 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 120 includes a non-transitory computer-readable storage medium. The memory 120 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The operating system may be an Android system, including a system deeply developed based on the Android system, an IOS system developed by Apple, including a system deeply developed based on the IOS system or other systems. The data storage area may also store data created by the electronic device during use, such as a phone book, audio and video data, chat record data, etc.
[0252] See also Figure 14As shown, the memory 120 can be divided into operating system space and user space. The operating system runs in the operating system space, and native and third-party applications run in the user space. In order to ensure that different third-party applications can achieve better operating results, the operating system allocates corresponding system resources to different third-party applications. However, the requirements for system resources in different application scenarios in the same third-party application are also different. For example, in the local resource loading scenario, the third-party application has higher requirements for disk reading speed; in the animation rendering scenario, the third-party application has higher requirements for GPU performance. The operating system and the third-party application are independent of each other, and the operating system often cannot perceive the current application scenario of the third-party application in a timely manner, resulting in the operating system being unable to perform targeted system resource adaptation according to the specific application scenario of the third-party application.
[0253] In order for the operating system to distinguish the specific application scenarios of third-party applications, it is necessary to open up data communication between third-party applications and the operating system so that the operating system can obtain the current scenario information of third-party applications at any time, and then perform targeted system resource adaptation based on the current scenario.
[0254] Taking the Android operating system as an example, the programs and data stored in the memory 120 are as follows: Figure 15As shown, the memory 120 may store a Linux kernel layer 320, a system runtime library layer 340, an application framework layer 360, and an application layer 380. The Linux kernel layer 320, the system runtime library layer 340, and the application framework layer 360 belong to the operating system space, and the application layer 380 belongs to the user space. The Linux kernel layer 320 provides underlying drivers for various hardware components of electronic devices, such as display drivers, audio drivers, camera drivers, Bluetooth drivers, Wi-Fi drivers, power management, etc. The system runtime library layer 340 provides major feature support for the Android system through some C / C++ libraries. For example, the SQLite library provides database support, the OpenGL / ES library provides 3D drawing support, and the Webkit library provides browser kernel support. The system runtime library layer 340 also provides the Android runtime library (Android runtime), which mainly provides some core libraries that allow developers to write Android applications using the Java language. The application framework layer 360 provides various APIs that may be used when building applications. Developers can also use these APIs to build their own applications, such as activity management, window management, view management, notification management, content provider management, package management, call management, resource management, and location management. The application layer 380 runs at least one application. These applications can be native applications that come with the operating system, such as contacts, SMS, clock, and camera applications, or third-party applications developed by third-party developers, such as games, instant messaging programs, and photo enhancement programs.
[0255] Taking the operating system as the IOS system as an example, the programs and data stored in the memory 120 are as follows: Figure 16As shown, the IOS system includes: a core operating system layer 420 (Core OS layer), a core service layer 440 (Core Services layer), a media layer 460 (Media layer), and a touchable layer 480 (Cocoa Touch Layer). The core operating system layer 420 includes the operating system kernel, drivers, and underlying program frameworks. These underlying program frameworks provide functions closer to the hardware for use by the program framework located in the core service layer 440. The core service layer 440 provides system services and / or program frameworks required by applications, such as the foundation framework, account framework, advertising framework, data storage framework, network connection framework, geographic location framework, motion framework, etc. The media layer 460 provides applications with audio-visual interfaces, such as graphics and image-related interfaces, audio technology-related interfaces, video technology-related interfaces, and wireless playback (AirPlay) interfaces for audio and video transmission technologies. The touchable layer 480 provides various commonly used interface-related frameworks for application development. The touchable layer 480 is responsible for user touch interaction operations on electronic devices. For example, local notification service, remote push service, advertising framework, game tool framework, message user interface (UI) framework, user interface UIKit framework, map framework, etc.
[0256] exist Figure 16 Among the frameworks shown, those relevant to most applications include, but are not limited to, the Foundation framework in the core services layer 440 and the UIKit framework in the touchable layer 480. The Foundation framework provides many basic object classes and data types, offering fundamental system services for all applications and having nothing to do with the UI. The classes provided by the UIKit framework are the foundational UI class library for creating touch-based user interfaces. iOS applications can use the UIKit framework to provide their UIs, providing the application infrastructure for building user interfaces, drawing, handling user interaction events, responding to gestures, and so on.
[0257] Among them, the method and principle of implementing data communication between third-party applications and operating system in the IOS system can be referred to the Android system, and this application will not go into details here.
[0258] Among them, the input device 130 is used to receive input instructions or data, and the input device 130 includes but is not limited to a keyboard, a mouse, a camera, a microphone or a touch device. The output device 140 is used to output instructions or data, and the output device 140 includes but is not limited to a display device and a speaker. In one example, the input device 130 and the output device 140 can be combined, and the input device 130 and the output device 140 are a touch screen display, which is used to receive touch operations on or near it by the user using any suitable object such as a finger or a touch pen, and to display the user interface of each application. The touch screen display is usually provided on the front panel of the electronic device. The touch screen display can be designed as a full screen, a curved screen or a special-shaped screen. The touch screen display can also be designed as a combination of a full screen and a curved screen, or a combination of a special-shaped screen and a curved screen, which is not limited in the embodiments of the present application.
[0259] In addition, those skilled in the art will understand that the structures of the electronic devices shown in the above figures do not limit the electronic devices. The electronic devices may include more or fewer components than shown, or may combine certain components, or arrange the components differently. For example, the electronic devices may also include radio frequency circuits, input units, sensors, audio circuits, wireless fidelity (WiFi) modules, power supplies, Bluetooth modules, and other components, which are not described in detail here.
[0260] In the embodiments of the present application, the execution subject of each step can be the electronic device described above. Optionally, the execution subject of each step is the operating system of the electronic device. The operating system can be an Android system, an iOS system, or other operating systems, which are not limited in the embodiments of the present application.
[0261] The electronic device of the embodiment of the present application may further be equipped with a display device, which may be any device capable of realizing a display function, such as a cathode ray tube display (CR), a light-emitting diode display (LED), an electronic ink screen, a liquid crystal display (LCD), a plasma display panel (PDP), etc. The user may use the display device on the electronic device 101 to view displayed text, images, videos and other information. The electronic device may be a smart phone, a tablet computer, a gaming device, an AR (Augmented Reality) device, a car, a data storage device, an audio playback device, a video playback device, a notebook, a desktop computing device, a wearable device such as an electronic watch, electronic glasses, an electronic helmet, an electronic bracelet, an electronic necklace, electronic clothing, and the like.
[0262] exist Figure 13 In the electronic device shown, which may be a terminal, the processor 1100 may be configured to call an application stored in the memory 120 and specifically perform the following operations:
[0263] Acquiring environmental information, and transmitting the environmental information to a second device;
[0264] Obtaining a symmetric key and reference initial parameters for the second device, and generating an initialization vector based on the environment information and the reference initial parameters;
[0265] The first data is encrypted based on the symmetric key and the initialization vector to obtain second data, and the second data is sent to the second device, where the second data is used to instruct the second device to decrypt the second data based on the reference initial parameters, the symmetric key and the environmental information.
[0266] In one embodiment, when executing the acquiring of the symmetric key for the second device and referring to the initial parameters, the processor 1001 specifically performs the following operations:
[0267] Obtaining a shared key string and second shared information for the second device, where the second shared information is shared information transmitted by the second device to the first device;
[0268] performing a first derivation process based on the key context information, the shared key string, first shared information, and second shared information to generate a symmetric key, where the first shared information is shared information transmitted from the first device to the second device;
[0269] A second derivation process is performed based on the vector context information, the shared key string, the first shared information, and the second shared information to generate a reference initial parameter.
[0270] In one embodiment, before executing the step of obtaining the current environment information, the processor 1100 further includes:
[0271] Performing information negotiation with the second device to generate key context information and vector context information;
[0272] The key context information and the vector context information are saved; the key context information is different from the vector context information.
[0273] In one embodiment, when the processor 1100 generates the initialization vector based on the environment information and the reference initial parameters, it specifically performs the following operations:
[0274] The environmental information and the reference initial parameters are processed by a target function to obtain an initialization vector after the function processing.
[0275] In one embodiment, when the processor 1100 performs the function processing on the environmental information and the reference initial parameters in an objective function manner to obtain the initialization vector after the function processing, the processor 1100 specifically performs the following operations:
[0276] Performing XOR processing on the environmental information and the reference initial parameter using an XOR function to obtain an XOR-processed initialization vector; or,
[0277] A hash function is used to perform hash processing on the environmental information and the reference initial parameters to obtain a hashed initialization vector.
[0278] In one embodiment, when the processor 1100 executes the steps of obtaining the current environment information and transmitting the environment information to the second device, the processor 1100 specifically performs the following operations:
[0279] Acquire current environmental information, and transmit an environmental information type corresponding to the environmental information to the second device, wherein the environmental information type is used to instruct the second device to acquire reference environmental information corresponding to the information type, and the reference environmental information is the same as the environmental information.
[0280] In one embodiment, when executing the acquisition of current environmental information, the processor 1100 specifically performs the following operations: determining an environmental information type from at least one reference information type, and acquiring environmental information indicated by the environmental information type.
[0281] In one embodiment, when the processor 1100 generates the initialization vector based on the environment information and the reference initial parameters, it specifically performs the following operations:
[0282] Determining a target function mode corresponding to the environment information type based on a function mapping relationship between the at least one reference information type and a reference function mode;
[0283] The environmental information and the reference initial parameters are processed by the objective function to obtain an initialization vector after the function processing.
[0284] See Figure 17 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 17 As shown, the electronic device 1000 may include: at least one processor 1001 , at least one network interface 1004 , a user interface 1003 , a memory 1005 , and at least one communication bus 1002 .
[0285] The communication bus 1002 is used to implement the connection and communication between these components.
[0286] The user interface 1003 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 1003 may also include a standard wired interface and a wireless interface.
[0287] The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
[0288] The processor 1001 may include one or more processing cores. The processor 1001 utilizes various interfaces and circuits to connect various components within the electronic device 1000. It executes instructions, programs, code sets, or instruction sets stored in the memory 1005, and accesses data stored in the memory 1005 to perform various functions and process data within the electronic device 1000. Optionally, the processor 1001 may be implemented using at least one of the following hardware forms: a digital signal processing (DSP), a field-programmable gate array (FPGA), or a programmable logic array (PLA). The processor 1001 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. The CPU primarily processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing content displayed on the display; and the modem handles wireless communications. It is understood that the modem may not be integrated into the processor 1001 but implemented as a separate chip.
[0289] Among them, the memory 1005 may include a random access memory (RAM) or a read-only memory (Read-Only Memory). Optionally, the memory 1005 includes a non-transitory computer-readable storage medium. The memory 1005 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 1005 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 1005 may optionally be at least one storage device located away from the aforementioned processor 1001. As Figure 17 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module and an application program.
[0290] exist Figure 17In the electronic device 1000 shown, the user interface 1003 is mainly used to provide an input interface for the user and obtain data input by the user; and the processor 1001 can be used to call the data transmission application stored in the memory 1005 and specifically perform the following operations:
[0291] Acquire environmental information transmitted by a first device, and receive second data sent by the first device; the second data is generated by encrypting the first data based on an initialization vector and a symmetric key;
[0292] Obtaining a symmetric key and reference initial parameters for the first device, and generating an initialization vector based on the environment information and the reference initial parameters;
[0293] The second data is decrypted based on the reference initial parameter, the symmetric key, and the environmental information to obtain third data.
[0294] In one embodiment, when executing the obtaining of the symmetric key for the first device and referring to the initial parameters, the processor 1001 specifically performs the following steps:
[0295] Obtaining a shared key string and first shared information for the first device, where the first shared information is shared information transmitted by the first device to the second device;
[0296] performing a second derivation process based on the key context information, the shared key string, second shared information, and the first shared information to generate a symmetric key, where the second shared information is shared information transmitted by the second device to the first device;
[0297] A first derivation process is performed based on the vector context information, the shared key string, the second shared information, and the first shared information to generate a reference initial parameter.
[0298] In one embodiment, before executing the step of obtaining the environment information transmitted by the first device, the processor 1001 further includes:
[0299] Performing information negotiation with the first device to generate key context information and vector context information;
[0300] The key context information and the vector context information are saved; the key context information is different from the vector context information.
[0301] In one embodiment, when the processor 1001 generates the initialization vector based on the environment information and the reference initial parameters, it specifically performs the following steps:
[0302] The environmental information and the reference initial parameters are processed using an objective function to obtain an initialization vector after the function processing.
[0303] In one embodiment, when executing the step of obtaining the environment information transmitted by the first device, the processor 1001 specifically performs the following steps:
[0304] receiving an environment information type transmitted by the first device, where the environment information type is a type corresponding to the environment information acquired by the first device;
[0305] Acquire reference environment information corresponding to the environment information type, and use the reference environment information as the environment information.
[0306] In one embodiment, when the processor 1001 generates the initialization vector based on the environment information and the reference initial parameters, it specifically performs the following steps:
[0307] determining a target function corresponding to the environmental information type based on a function mapping relationship between the at least one reference information type and a reference function;
[0308] The objective function is used to perform function processing on the environmental information and the reference initial parameters to obtain an initialization vector after function processing.
[0309] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing related hardware through a computer program. The program can be stored in a computer-readable storage medium, and when executed, the program can include the processes in the above-described method embodiments. The storage medium can be a magnetic disk, an optical disk, a read-only memory, or a random access memory.
[0310] The above disclosure is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A data transmission method, characterized in that: Applied to a first device, the method includes: Acquiring environmental information, and transmitting the environmental information to a second device; Obtaining a symmetric key and reference initial parameters for the second device, and generating an initialization vector based on the environment information and the reference initial parameters; The first data is encrypted based on the symmetric key and the initialization vector to obtain second data, and the second data is sent to the second device, where the second data is used to instruct the second device to decrypt the second data based on the reference initial parameters, the symmetric key and the environmental information.
2. The method according to claim 1, characterized in that The obtaining of the symmetric key and the reference initial parameters for the second device includes: Obtaining a shared key string and second shared information for the second device, where the second shared information is shared information transmitted by the second device to the first device; performing a first derivation process based on the key context information, the shared key string, first shared information, and second shared information to generate a symmetric key, where the first shared information is shared information transmitted from the first device to the second device; A second derivation process is performed based on the vector context information, the shared key string, the first shared information, and the second shared information to generate a reference initial parameter.
3. The method according to claim 2, characterized in that Before obtaining the environment information, the method further includes: Performing information negotiation with the second device to generate key context information and vector context information; The key context information and the vector context information are saved; the key context information is different from the vector context information.
4. The method according to claim 1, wherein The generating an initialization vector based on the environmental information and the reference initial parameters includes: The environmental information and the reference initial parameters are processed by a target function to obtain an initialization vector after the function processing.
5. The method according to claim 4, characterized in that The adopting the objective function method to perform function processing on the environmental information and the reference initial parameters to obtain the initialization vector after function processing includes: Performing XOR processing on the environmental information and the reference initial parameter using an XOR function to obtain an XOR-processed initialization vector; or, A hash function is used to perform hash processing on the environmental information and the reference initial parameters to obtain a hashed initialization vector.
6. The method according to claim 1, characterized in that The acquiring of the environment information and transmitting the environment information to the second device includes: Acquire current environmental information, and transmit an environmental information type corresponding to the environmental information to the second device, wherein the environmental information type is used to instruct the second device to acquire reference environmental information corresponding to the information type, and the reference environmental information is the same as the environmental information.
7. The method according to claim 1 or 6, characterized in that The obtaining of the environment information includes: An environmental information type is determined from at least one reference information type, and environmental information indicated by the environmental information type is acquired.
8. The method according to claim 7, characterized in that The generating an initialization vector based on the environmental information and the reference initial parameters includes: Determining a target function mode corresponding to the environment information type based on a function mapping relationship between the at least one reference information type and a reference function mode; The environmental information and the reference initial parameters are processed by the objective function to obtain an initialization vector after the function processing.
9. A data transmission method, characterized in that: Applied to the second device, the method includes: Acquire environmental information transmitted by a first device, and receive second data sent by the first device; the second data is generated by encrypting the first data based on an initialization vector and a symmetric key; Obtaining a symmetric key and reference initial parameters for the first device, and generating an initialization vector based on the environment information and the reference initial parameters; The second data is decrypted based on the reference initial parameter, the symmetric key, and the environmental information to obtain third data.
10. The method according to claim 9, characterized in that The obtaining of a symmetric key and a reference initial parameter for the first device includes: Obtaining a shared key string and first shared information for the first device, where the first shared information is shared information transmitted by the first device to the second device; performing a second derivation process based on the key context information, the shared key string, second shared information, and the first shared information to generate a symmetric key, where the second shared information is shared information transmitted by the second device to the first device; A first derivation process is performed based on the vector context information, the shared key string, the second shared information, and the first shared information to generate a reference initial parameter.
11. The method according to claim 10, characterized in that Before acquiring the environmental information transmitted by the first device, the method further includes: Performing information negotiation with the first device to generate key context information and vector context information; The key context information and the vector context information are saved; the key context information is different from the vector context information.
12. The method according to claim 9, characterized in that The generating an initialization vector based on the environmental information and the reference initial parameters includes: The environmental information and the reference initial parameters are processed using an objective function to obtain an initialization vector after the function processing.
13. The method according to claim 9, characterized in that The obtaining of the environmental information transmitted by the first device includes: receiving an environment information type transmitted by the first device, where the environment information type is a type corresponding to the environment information acquired by the first device; Acquire reference environment information corresponding to the environment information type, and use the reference environment information as the environment information.
14. The method according to claim 13, characterized in that The generating an initialization vector based on the environmental information and the reference initial parameters includes: Determining a target function corresponding to the environmental information type based on a function mapping relationship between at least one reference information type and a reference function; The objective function is used to perform function processing on the environmental information and the reference initial parameters to obtain an initialization vector after function processing.
15. A data transmission device, characterized in that: The device comprises: a transmission module, configured to obtain current environmental information and transmit the environmental information to a second device; a vector generation module, configured to obtain a symmetric key and reference initial parameters for the second device, and generate an initialization vector based on the environment information and the reference initial parameters; A data encryption module is used to encrypt the first data based on the symmetric key and the initialization vector to obtain second data, and send the second data to the second device, where the second data is used to instruct the second device to decrypt the second data based on the reference initial parameters, the symmetric key and the environmental information.
16. A data transmission device, characterized in that: The device comprises: an information acquisition module, configured to acquire environmental information transmitted by a first device and receive second data sent by the first device; a vector generation module, configured to obtain a symmetric key and reference initial parameters for the first device, and generate an initialization vector based on the environment information and the reference initial parameters; The data decryption module is used to decrypt the second data based on the reference initial parameters, the symmetric key and the environmental information to obtain third data.
17. A computer storage medium, characterized in that The computer storage medium stores a plurality of instructions, which are suitable for being loaded by a processor and executing the method steps according to any one of claims 1 to 8 or 9 to 14.
18. An electronic device, characterized in that: include: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the method steps according to any one of claims 1 to 8 or 9 to 14.
Citation Information
Patent Citations
Method and equipment for writing in seed secret key in NFC dynamic token
CN106100830A
Data encryption method and device and data decryption method and device
CN113158218A