Internet of Things data transmission method and device, transmission equipment and storage medium
By encrypting and processing agricultural IoT data, using session keys and HMAC keys to ensure data security and integrity, the problem of insufficient security of IoT data transmission in the prior art is solved.
Patent Information
- Application Number
- CN202410811991.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-11-08
AI Technical Summary
The existing IoT data transmission methods do not encrypt agricultural IoT data, resulting in vulnerability to hackers during transmission and lack of security.
By sending network authentication requests to the server, creating a transmission channel, obtaining a session key for encryption, hashing the data using the HMAC key and hash function, and generating the encrypted IoT data and HMAC values, ensuring that the data is in the transmission process. security and integrity in.
It improves the security of agricultural IoT data during transmission process and ensures data integrity through HMAC values, solving the problem of vulnerability to unencrypted data.
Smart Images

Figure CN118921181A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to an Internet of Things data transmission method, apparatus, transmission equipment and storage medium. Background Art
[0002] With the continuous improvement of the degree of agricultural informatization, agricultural Internet of Things data transmission plays an increasingly important role in modern agriculture. These links not only improve the efficiency of agricultural production, but also promote the sustainable development of agriculture.
[0003] However, the existing IoT data transmission method does not encrypt the agricultural IoT data, which is not conducive to improving the security of the agricultural IoT data during transmission. The reason is that the existing IoT data transmission method does not encrypt the agricultural IoT data, and the unencrypted agricultural IoT data is extremely vulnerable to hacker attacks and interception during transmission. Attackers can easily obtain these unencrypted agricultural IoT data, and then may use these unencrypted agricultural IoT data for illegal activities. Therefore, the existing IoT data transmission method does not encrypt the agricultural IoT data, which is not conducive to improving the security of the agricultural IoT data during transmission. Summary of the invention
[0004] The embodiments of the present application provide an Internet of Things data transmission method, device, transmission equipment and storage medium to solve the technical problem that the above-mentioned existing Internet of Things data transmission method does not encrypt agricultural Internet of Things data, which is not conducive to improving the security of agricultural Internet of Things data during the transmission process.
[0005] In a first aspect, an embodiment of the present application provides an Internet of Things data transmission method, which is applied to an agricultural Internet of Things data transmission device, wherein the agricultural Internet of Things data transmission device is connected to an agricultural sensor and a server respectively, and the Internet of Things data transmission method includes:
[0006] Sending a network access authentication request to the server, wherein the network access authentication request includes an agricultural sensor identifier, a server identifier, and a digital certificate;
[0007] receiving a response message returned by the server based on the network access authentication request, and identifying the response message;
[0008] When the response message is identified as a passing message, a transmission channel is created between the device and the server;
[0009] Acquire a session key through the transmission channel, and encrypt a preset counter with the session key to obtain a key stream;
[0010] Based on the key stream, determining the encrypted agricultural Internet of Things data;
[0011] Using a preset HMAC key and hash function, a hash calculation is performed on the encrypted agricultural Internet of Things data to generate an HMAC value corresponding to the encrypted agricultural Internet of Things data;
[0012] The encrypted agricultural Internet of Things data and the HMAC value are packaged to generate target data, and the target data is uploaded to the server through the transmission channel.
[0013] Exemplarily, the agricultural Internet of Things data transmission device is a device for transmitting agricultural Internet of Things data, and the agricultural Internet of Things data includes one or a combination of soil moisture data, soil temperature data, soil nutrient data, and light data;
[0014] Exemplarily, using a preset HMAC key and hash function, performing hash calculation on the encrypted agricultural Internet of Things data to generate an HMAC value corresponding to the encrypted agricultural Internet of Things data includes:
[0015] Determine the hash function identifier corresponding to the agricultural sensor identifier, use a preset HMAC key and the hash function corresponding to the hash function identifier, perform hash calculation on the encrypted agricultural Internet of Things data, and generate an HMAC value corresponding to the encrypted agricultural Internet of Things data, each hash function identifier corresponds to one hash function, and different hash function identifiers correspond to different hash functions.
[0016] In a possible implementation manner of the first aspect, the sending the network access authentication request to the server includes:
[0017] A network access authentication request is sent to the server through a network security protocol, wherein the network security protocol includes one of the SSL protocol and the TLS protocol or a combination thereof.
[0018] In a possible implementation manner of the first aspect, acquiring a session key through the transmission channel, and encrypting a preset counter through the session key to obtain a key stream includes:
[0019] Acquire a session key through the transmission channel, acquire a file path, and import the counter through the file path;
[0020] The counter is encrypted by the session key to obtain the key stream.
[0021] In a possible implementation manner of the first aspect, determining the encrypted agricultural Internet of Things data based on the key stream includes:
[0022] Sending a data acquisition request to the agricultural sensor, receiving sensor data returned by the agricultural sensor according to the data acquisition request, and combining the sensor data corresponding to a plurality of the agricultural sensors to obtain the agricultural Internet of Things data;
[0023] Within a preset time, detecting whether an update instruction sent by the agricultural sensor is received, wherein the update instruction is an instruction to update the agricultural Internet of Things data;
[0024] If the update instruction is not received within the preset time, the agricultural Internet of Things data is XORed with the key stream to generate encrypted agricultural Internet of Things data.
[0025] In a possible implementation manner of the first aspect, packaging the encrypted agricultural Internet of Things data and the HMAC value to generate target data, and uploading the target data to the server through the transmission channel includes:
[0026] Packing the encrypted agricultural Internet of Things data and the HMAC value to generate the target data;
[0027] Read the preset upload time and determine whether the current time is the upload time;
[0028] If the current time is the upload time, the target data is uploaded to the server through the transmission channel.
[0029] In a possible implementation manner of the first aspect, after packaging the encrypted agricultural Internet of Things data and the HMAC value to generate target data, and uploading the target data to the server through the transmission channel, the Internet of Things data transmission method further includes:
[0030] A target file corresponding to the target data is established, and the target data is stored in the target file.
[0031] In a possible implementation manner of the first aspect,
[0032] The agricultural sensor identifier is the device identifier of the agricultural sensor, and the server identifier is the device identifier of the server;
[0033] The agricultural sensor includes one or a combination of a soil moisture sensor, a soil temperature sensor, a soil nutrient sensor and a light sensor.
[0034] In a second aspect, an embodiment of the present application provides an Internet of Things data transmission device, which is applied to an agricultural Internet of Things data transmission device, wherein the agricultural Internet of Things data transmission device is connected to an agricultural sensor and a server respectively, including:
[0035] A sending module, used for sending a network access authentication request to the server, wherein the network access authentication request includes an agricultural sensor identifier, a server identifier and a digital certificate;
[0036] A receiving module, configured to receive a response message returned by the server based on the network access authentication request, and identify the response message;
[0037] A creation module, used for creating a transmission channel between the device and the server when the response message is identified as a pass message;
[0038] An acquisition module, used for acquiring a session key through the transmission channel, and encrypting a preset counter with the session key to obtain a key stream;
[0039] An encryption module, used to determine the encrypted agricultural Internet of Things data based on the key stream;
[0040] A generation module, used to use a preset HMAC key and hash function to perform hash calculation on the encrypted agricultural Internet of Things data to generate an HMAC value corresponding to the encrypted agricultural Internet of Things data;
[0041] The transmission module is used to package the encrypted agricultural Internet of Things data and the HMAC value, generate target data, and upload the target data to the server through the transmission channel.
[0042] In a third aspect, an embodiment of the present application provides an agricultural Internet of Things data transmission device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the Internet of Things data transmission method of any one of the first aspects described above is implemented.
[0043] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the Internet of Things data transmission method of any one of the above-mentioned first aspects is implemented.
[0044] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product runs on an agricultural Internet of Things data transmission device, the agricultural Internet of Things data transmission device executes the Internet of Things data transmission method described in any one of the above-mentioned first aspects.
[0045] The beneficial effects of the embodiments of the present application lie in two aspects. On the one hand, the encrypted agricultural Internet of Things data and the HMAC value are packaged to generate target data, and the target data is uploaded to the server through the transmission channel. Since the target data includes the encrypted agricultural Internet of Things data, the problem that the existing Internet of Things data transmission method does not encrypt the agricultural Internet of Things data is solved, which is beneficial to improving the security of the agricultural Internet of Things data in the transmission process; on the other hand, the HMAC value of the target data is beneficial to ensuring the integrity of the encrypted agricultural Internet of Things data. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0047] Figure 1 An application scenario diagram of the Internet of Things data transmission method provided in an embodiment of the present application;
[0048] Figure 2 It is a flowchart of the Internet of Things data transmission method provided by an embodiment of the present application;
[0049] Figure 3 A flowchart for uploading agricultural Internet of Things data provided in an embodiment of the present application;
[0050] Figure 4 A schematic block diagram of an Internet of Things data transmission device provided in an embodiment of the present application;
[0051] Figure 5 A schematic diagram of the structure of the agricultural Internet of Things data transmission equipment provided in an embodiment of the present application. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0053] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0054] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0055] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0056] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0057] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0058] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0059] In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the fact that they can be implemented by ordinary technicians in this field. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0060] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0061] The Internet of Things data transmission method provided in the embodiment of the present application can be applied to agricultural Internet of Things data transmission devices such as data collectors, mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR) / virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPC), netbooks, personal digital assistants (PDA), etc. The embodiment of the present application does not impose any restrictions on the specific type of agricultural Internet of Things data transmission equipment.
[0062] See also Figure 1 , Figure 1 The application scenario diagram of the Internet of Things data transmission method provided in the embodiment of the present application is detailed as follows:
[0063] The agricultural Internet of Things data transmission equipment is connected to the agricultural sensor and the server respectively.
[0064] Among them, agricultural Internet of Things data transmission equipment is connected to the server through a gateway.
[0065] Among them, the agricultural Internet of Things data transmission device can be connected to one agricultural sensor, and the agricultural Internet of Things data transmission device can also be connected to multiple agricultural sensors.
[0066] For the sake of explanation, the multiple agricultural sensors are taken as two agricultural sensors as an example, which are described in detail as follows:
[0067] The two agricultural sensors include an agricultural sensor A and an agricultural sensor B. The agricultural Internet of Things data transmission device is connected to the agricultural sensor A and the agricultural sensor B respectively, obtains sensor data A1 from the agricultural sensor A, obtains sensor data B1 from the agricultural sensor B, combines the sensor data A1 and the sensor data B1, and obtains the agricultural Internet of Things data;
[0068] In an embodiment of the present application, the agricultural Internet of Things data transmission device can simultaneously connect to different agricultural sensors and obtain different sensor data from different agricultural sensors.
[0069] See also Figure 2 , Figure 2 It is a flow chart of the Internet of Things data transmission method provided in an embodiment of the present application. The method can be applied to agricultural Internet of Things data transmission equipment, and the agricultural Internet of Things data transmission equipment is connected to agricultural sensors and servers respectively.
[0070] like Figure 2 As shown, the IoT data transmission method provided in the embodiment of the present application includes the following steps, which are described in detail as follows:
[0071] S201, sending a network access authentication request to the server, wherein the network access authentication request includes an agricultural sensor identifier, a server identifier, and a digital certificate;
[0072] The sending of the network access authentication request to the server includes:
[0073] A network access authentication request is sent to the server through a network security protocol, wherein the network security protocol includes one of the SSL protocol and the TLS protocol or a combination thereof.
[0074] Among them, the Chinese name of SSL protocol is Secure Sockets Layer Protocol, and the English name of SSL protocol is Secure Sockets Layer. SSL protocol is a security protocol that provides security and data integrity for network communications.
[0075] Among them, the Chinese name of TLS protocol is Transport Layer Security Protocol, and the English name of TLS protocol is Transport Layer Security. The TLS protocol provides the same functions as SSL, but has made improvements in security and fixed some known security vulnerabilities in SSL.
[0076] The agricultural sensor identifier is the device identifier of the agricultural sensor, and the server identifier is the device identifier of the server;
[0077] The agricultural sensor includes one or a combination of a soil moisture sensor, a soil temperature sensor, a soil nutrient sensor and a light sensor.
[0078] For the sake of illustration, an example is given below:
[0079] For example, when the agricultural sensor is a soil moisture sensor, the soil moisture sensor is used to monitor the soil moisture in real time. The sensor data collected by the soil moisture sensor can accurately grasp the soil moisture conditions, so as to carry out precise irrigation, avoid the problem of over-irrigation or under-irrigation, improve irrigation efficiency, save water resources, provide suitable moisture conditions for crop growth, and improve crop yield and quality.
[0080] For example, when the agricultural sensor is a soil moisture sensor, the soil temperature sensor is used in combination with the soil moisture sensor to provide comprehensive soil environment information for crop growth. By monitoring soil temperature, suitable temperature conditions are provided for crop growth. Combined with soil moisture data, crop moisture and nutrient requirements can be more accurately determined, providing a decision-making basis for scientific planting.
[0081] For example, when the agricultural sensor is a soil nutrient sensor, by real-time monitoring of soil nutrient conditions, the farm can develop a scientific fertilization plan and achieve improved crop yield and quality. This can monitor soil nutrient content in real time, provide a scientific basis for precise fertilization, improve fertilizer utilization, and reduce environmental pollution.
[0082] For example, when the agricultural sensor is a soil nutrient sensor, a light sensor is used in a greenhouse to monitor the light intensity in real time and provide suitable light conditions for crop growth.
[0083] The application of agricultural sensors in agriculture makes agricultural production more scientific and precise. By real-time monitoring of soil and environmental parameters, users can more accurately grasp the growth conditions of crops, formulate scientific planting plans and management measures, thereby improving crop yields and quality and reducing environmental pollution.
[0084] S202, receiving a response message returned by the server based on the network access authentication request, and identifying the response message;
[0085] Among them, a response message returned by the server based on the network access authentication request is received and stored, and it is identified whether the response message includes a success mark.
[0086] S203, when the response message is identified as a passing message, creating a transmission channel between the device and the server;
[0087] When the response message includes a success identifier, the response message is identified as a pass message, and a transmission channel is established between the device and the server.
[0088] S204, obtaining a session key through the transmission channel, and encrypting a preset counter with the session key to obtain a key stream;
[0089] The step of obtaining a session key through the transmission channel and encrypting a preset counter through the session key to obtain a key stream includes:
[0090] Acquire a session key through the transmission channel, acquire a file path, and import the counter through the file path;
[0091] The counter is encrypted by the session key to obtain the key stream.
[0092] S205, determining encrypted agricultural Internet of Things data based on the key stream;
[0093] Wherein, determining the encrypted agricultural Internet of Things data based on the key stream includes:
[0094] Sending a data acquisition request to the agricultural sensor, receiving sensor data returned by the agricultural sensor according to the data acquisition request, and combining the sensor data corresponding to a plurality of the agricultural sensors to obtain the agricultural Internet of Things data;
[0095] Within a preset time, detecting whether an update instruction sent by the agricultural sensor is received, wherein the update instruction is an instruction to update the agricultural Internet of Things data;
[0096] If the update instruction is not received within the preset time, the agricultural Internet of Things data is XORed with the key stream to generate encrypted agricultural Internet of Things data.
[0097] The preset time is set by the user or by the system default and is not restricted here.
[0098] The sensor data corresponding to the plurality of agricultural sensors are combined to obtain the agricultural Internet of Things data. For ease of explanation, an example is given below:
[0099] There are a plurality of agricultural sensors, namely, agricultural sensor 1 and agricultural sensor 2; agricultural sensor 1 includes a soil moisture sensor, a soil temperature sensor, and a soil nutrient sensor; agricultural sensor 2 includes a soil moisture sensor, a soil temperature sensor, a soil nutrient sensor, and a light sensor;
[0100] The sensor data corresponding to the soil moisture sensor, soil temperature sensor, and soil nutrient sensor in the agricultural sensor 1 are combined with the sensor data corresponding to the soil moisture sensor, soil temperature sensor, soil nutrient sensor, and light sensor in the agricultural sensor 2 to obtain the agricultural Internet of Things data.
[0101] For example, the sensor data corresponding to the soil moisture sensor, soil temperature sensor, and soil nutrient sensor in the agricultural sensor 1 are sensor data 01, sensor data 02, and sensor data 03 respectively;
[0102] For example, the sensor data corresponding to the soil moisture sensor, soil temperature sensor, soil nutrient sensor, and light sensor in the agricultural sensor 2 are sensor data 04, sensor data 05, sensor data 06, and sensor data 07 respectively;
[0103] The sensor data 01, sensor data 02, sensor data 03, sensor data 04, sensor data 05, sensor data 06, and sensor data 07 are combined to obtain the agricultural Internet of Things data.
[0104] If the update instruction is not received within the preset time, it means that the agricultural IoT data does not need to be updated and is stable. Stable agricultural IoT data can reduce unnecessary interference and misjudgment, allowing users to make long-term plans and decisions based on agricultural IoT data to achieve healthy growth of crops and maximize yields. This stability not only improves the efficiency of agricultural production, but also promotes the rational use of agricultural resources and environmental protection.
[0105] S206, using a preset HMAC key and hash function to perform hash calculation on the encrypted agricultural Internet of Things data to generate an HMAC value corresponding to the encrypted agricultural Internet of Things data;
[0106] Among them, HMAC (Hash-based Message Authentication Code) is a message authentication code algorithm based on a key and a hash function.
[0107] Exemplarily, using a preset HMAC key and hash function, performing hash calculation on the encrypted agricultural Internet of Things data to generate an HMAC value corresponding to the encrypted agricultural Internet of Things data includes:
[0108] Determine the hash function identifier corresponding to the agricultural sensor identifier, use a preset HMAC key and the hash function corresponding to the hash function identifier, perform hash calculation on the encrypted agricultural Internet of Things data, and generate an HMAC value corresponding to the encrypted agricultural Internet of Things data, each hash function identifier corresponds to one hash function, and different hash function identifiers correspond to different hash functions.
[0109] For the sake of illustration, an example is given below:
[0110] For example, there is a hash function identifier A and a hash function identifier B. The hash function identifier A corresponds to the hash function A, and the hash function identifier B corresponds to the hash function B.
[0111] When it is determined that the hash function identifier corresponding to the agricultural sensor identifier is hash function identifier A, the preset HMAC key and hash function A are used to perform hash calculation on the encrypted agricultural Internet of Things data to generate an HMAC value corresponding to the encrypted agricultural Internet of Things data.
[0112] For example, when it is determined that the hash function identifier corresponding to the agricultural sensor identifier is hash function identifier B, the preset HMAC key and hash function B are used to perform hash calculation on the encrypted agricultural Internet of Things data to generate an HMAC value corresponding to the encrypted agricultural Internet of Things data.
[0113] S207, packing the encrypted agricultural Internet of Things data and the HMAC value to generate target data, and uploading the target data to the server through the transmission channel.
[0114] Among them, the HMAC value is used to verify whether the agricultural IoT data has been tampered with during transmission.
[0115] For the sake of illustration, an example is given below:
[0116] The agricultural IoT data transmission device uses the HMAC key and hash function to perform hash calculation on the agricultural IoT data and generates the HMAC value as the first HMAC value.
[0117] The first HMAC value is transmitted to the server together with the Agricultural IoT data.
[0118] The server's judgment process:
[0119] The server first receives the agricultural IoT data and the first HMAC value.
[0120] The server uses the same HMAC key and hash function as the Agricultural IoT data transmission device to perform hash calculation on the received Agricultural IoT data to generate a second HMAC value.
[0121] Compare the second HMAC value with the first HMAC value received. If the second HMAC value is consistent with the first HMAC value received, it means that the Agricultural Internet of Things data has not been tampered with during transmission, and the sender of the Agricultural Internet of Things data has the correct HMAC key. Therefore, the integrity of the Agricultural Internet of Things data and the identity of the sender can be confirmed.
[0122] If the second HMAC value is inconsistent with the first HMAC value received, it means that the Agricultural IoT data may have been tampered with during transmission, or the sender of the message does not have the correct HMAC key, so the integrity of the Agricultural IoT data and the identity of the sender cannot be confirmed.
[0123] Wherein, after packaging the encrypted agricultural Internet of Things data and the HMAC value to generate target data, and uploading the target data to the server through the transmission channel, the Internet of Things data transmission method further includes:
[0124] A target file corresponding to the target data is established, and the target data is stored in the target file.
[0125] Exemplarily, the agricultural Internet of Things data transmission device is a device for transmitting agricultural Internet of Things data, and the agricultural Internet of Things data includes one or a combination of soil moisture data, soil temperature data, soil nutrient data, and light data;
[0126] The beneficial effects of the embodiments of the present application lie in two aspects. On the one hand, the encrypted agricultural Internet of Things data and the HMAC value are packaged to generate target data, and the target data is uploaded to the server through the transmission channel. Since the target data includes the encrypted agricultural Internet of Things data, the problem that the existing Internet of Things data transmission method does not encrypt the agricultural Internet of Things data is solved, which is beneficial to improving the security of the agricultural Internet of Things data in the transmission process; on the other hand, the HMAC value of the target data is beneficial to ensuring the integrity of the encrypted agricultural Internet of Things data.
[0127] See also Figure 3 , Figure 3 The flowchart for uploading agricultural Internet of Things data provided in the embodiment of this application is detailed as follows:
[0128] S301, packing the encrypted agricultural Internet of Things data and the HMAC value to generate the target data;
[0129] S302, reading a preset upload time, and determining whether the current time is the upload time;
[0130] The upload time is set by the user or by system default and is not restricted here.
[0131] S303: If the current time is the upload time, upload the target data to the server through the transmission channel.
[0132] Among them, the decision center is connected to the server, and the decision center can read the agricultural Internet of Things data in the target data through the server, and then make reasonable agricultural management decisions.
[0133] In an embodiment of the present application, if the current time is the upload time, the target data is uploaded to the server through the transmission channel. Since the target data includes the encrypted agricultural Internet of Things data, uploading the agricultural Internet of Things data in the target data to the server through the transmission channel is beneficial to improving the security of the agricultural Internet of Things data.
[0134] For the IoT data transmission method described in the above embodiment, please refer to Figure 4 , Figure 4 A schematic block diagram of an IoT data transmission device provided in an embodiment of the present application, Figure 4 The IoT data transmission device 400 shown can be applied to Figure 1 The agricultural Internet of Things data transmission device in the application scenario diagram shown below takes the agricultural Internet of Things data transmission device as an example. Figure 4 The IoT data transmission device 400 shown is described in detail. The IoT data transmission device 400 may include a sending module 401, a receiving module 402, a creating module 403, an acquiring module 404, an encryption module 405, a generating module 406, and a transmitting module 407.
[0135] A sending module 401 is used to send a network access authentication request to the server, wherein the network access authentication request includes an agricultural sensor identifier, a server identifier, and a digital certificate;
[0136] The receiving module 402 is used to receive a response message returned by the server based on the network access authentication request, and identify the response message;
[0137] A creation module 403, configured to create a transmission channel between the device and the server when the response message is identified as a pass message;
[0138] An acquisition module 404 is used to acquire a session key through the transmission channel, and encrypt a preset counter with the session key to obtain a key stream;
[0139] An encryption module 405 is used to determine the encrypted agricultural Internet of Things data based on the key stream;
[0140] A generation module 406 is used to perform hash calculation on the encrypted agricultural Internet of Things data using a preset HMAC key and hash function to generate an HMAC value corresponding to the encrypted agricultural Internet of Things data;
[0141] The transmission module 407 is used to package the encrypted agricultural Internet of Things data and the HMAC value to generate target data, and upload the target data to the server through the transmission channel.
[0142] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0143] The beneficial effects of the embodiments of the present application lie in two aspects. On the one hand, the encrypted agricultural Internet of Things data and the HMAC value are packaged to generate target data, and the target data is uploaded to the server through the transmission channel. Since the target data includes the encrypted agricultural Internet of Things data, the problem that the existing Internet of Things data transmission method does not encrypt the agricultural Internet of Things data is solved, which is beneficial to improving the security of the agricultural Internet of Things data in the transmission process; on the other hand, the HMAC value of the target data is beneficial to ensuring the integrity of the encrypted agricultural Internet of Things data.
[0144] See also Figure 5 , Figure 5 A schematic diagram of the structure of the agricultural Internet of Things data transmission equipment provided in an embodiment of the present application.
[0145] like Figure 5 As shown, Figure 5 The agricultural Internet of Things data transmission device 2 includes: at least one processor 20, a memory 21, and a computer program 22 stored in the memory 21 and executable on the at least one processor 20. When the processor 20 executes the computer program 22, the steps in any of the above-mentioned method embodiments are implemented.
[0146] The agricultural Internet of Things data transmission device 2 may include, but is not limited to, a processor 20 and a memory 21. Those skilled in the art will appreciate that Figure 5 It is only an example of the agricultural Internet of Things data transmission device 2 and does not constitute a limitation of the agricultural Internet of Things data transmission device 2. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components, for example, it may also include input and output devices, network access devices, etc.
[0147] The processor 20 is used to run the computer program 22 stored in the memory 21, and implement the following steps when executing the computer program 22:
[0148] Sending a network access authentication request to the server, wherein the network access authentication request includes an agricultural sensor identifier, a server identifier, and a digital certificate;
[0149] receiving a response message returned by the server based on the network access authentication request, and identifying the response message;
[0150] When the response message is identified as a passing message, a transmission channel is created between the device and the server;
[0151] Acquire a session key through the transmission channel, and encrypt a preset counter with the session key to obtain a key stream;
[0152] Based on the key stream, the encrypted agricultural Internet of Things data is determined; using a preset HMAC key and hash function, a hash calculation is performed on the encrypted agricultural Internet of Things data to generate an HMAC value corresponding to the encrypted agricultural Internet of Things data; the encrypted agricultural Internet of Things data and the HMAC value are packaged to generate target data, and the target data is uploaded to the server through the transmission channel.
[0153] In some embodiments, the processor 20 is configured to implement:
[0154] The network authentication request is sent to the server through a network security protocol, wherein the network security protocol includes one of the SSL protocol and the TLS protocol or a combination thereof. In some embodiments, the processor 20 is configured to implement:
[0155] Acquire a session key through the transmission channel, acquire a file path, and import the counter through the file path;
[0156] The counter is encrypted by the session key to obtain the key stream.
[0157] In some embodiments, the processor 20 is configured to implement:
[0158] Sending a data acquisition request to the agricultural sensor, receiving sensor data returned by the agricultural sensor according to the data acquisition request, and combining the sensor data corresponding to a plurality of the agricultural sensors to obtain the agricultural Internet of Things data;
[0159] Within a preset time, detecting whether an update instruction sent by the agricultural sensor is received, wherein the update instruction is an instruction to update the agricultural Internet of Things data;
[0160] If the update instruction is not received within the preset time, the agricultural Internet of Things data is XORed with the key stream to generate encrypted agricultural Internet of Things data.
[0161] In some embodiments, the processor 20 is configured to implement:
[0162] Packing the encrypted agricultural Internet of Things data and the HMAC value to generate the target data;
[0163] Read the preset upload time and determine whether the current time is the upload time;
[0164] If the current time is the upload time, the target data is uploaded to the server through the transmission channel.
[0165] In some embodiments, the processor 20 is configured to implement:
[0166] A target file corresponding to the target data is established, and the target data is stored in the target file.
[0167] In some embodiments, the processor 20 is configured to implement:
[0168] The agricultural sensor identifier is the device identifier of the agricultural sensor, and the server identifier is the device identifier of the server;
[0169] The agricultural sensor includes one or a combination of a soil moisture sensor, a soil temperature sensor, a soil nutrient sensor and a light sensor.
[0170] The processor 20 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0171] In some embodiments, the memory 21 may be an internal storage unit of the agricultural Internet of Things data transmission device 2, such as a hard disk or memory of the agricultural Internet of Things data transmission device 2. In other embodiments, the memory 21 may also be an external storage device of the agricultural Internet of Things data transmission device 2, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the agricultural Internet of Things data transmission device 2. Further, the memory 21 may also include both an internal storage unit and an external storage device of the agricultural Internet of Things data transmission device 2. The memory 21 is used to store an operating system, an application, a boot loader (Boot Loader), data, and other programs, such as the program code of the computer program, etc. The memory 21 may also be used to temporarily store data that has been output or is to be output.
[0172] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0173] An embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0174] The computer-readable storage medium stores program code, which can be called by a processor to execute the Internet of Things data transmission method described in the above method embodiment.
[0175] The computer-readable storage medium has a storage space for program codes.
[0176] The program code includes the code of any step in the Internet of Things data transmission method described in the above method embodiment.
[0177] For example, the program code is called by the processor and can execute the following steps:
[0178] Sending a network access authentication request to the server, wherein the network access authentication request includes an agricultural sensor identifier, a server identifier, and a digital certificate;
[0179] receiving a response message returned by the server based on the network access authentication request, and identifying the response message;
[0180] When the response message is identified as a passing message, a transmission channel is created between the device and the server;
[0181] Acquire a session key through the transmission channel, and encrypt a preset counter with the session key to obtain a key stream;
[0182] Based on the key stream, determining the encrypted agricultural Internet of Things data;
[0183] Using a preset HMAC key and hash function, a hash calculation is performed on the encrypted agricultural Internet of Things data to generate an HMAC value corresponding to the encrypted agricultural Internet of Things data;
[0184] The encrypted agricultural Internet of Things data and the HMAC value are packaged to generate target data, and the target data is uploaded to the server through the transmission channel.
[0185] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0186] Among them, the computer-readable storage medium can also be an external storage device of the Internet of Things data transmission device or the agricultural Internet of Things data transmission equipment, for example, a plug-in hard disk equipped on the Internet of Things data transmission device or the agricultural Internet of Things data transmission equipment, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), a non-volatile computer-readable medium (non-transitory computer-readable storage medium), etc.
[0187] Since the computer program stored in the computer-readable storage medium can execute any one of the Internet of Things data transmission methods provided in the embodiments of the present application, the computer-readable storage medium can achieve the beneficial effects that can be achieved by any one of the Internet of Things data transmission methods provided in the embodiments of the present application. For details, please refer to the previous embodiments and will not be repeated here.
[0188] An embodiment of the present application provides a computer program product. When the computer program product runs on an agricultural Internet of Things data transmission device, the agricultural Internet of Things data transmission device executes the above-mentioned Internet of Things data transmission method.
[0189] The computer program product is loaded by the agricultural Internet of Things data transmission device and can perform the following steps:
[0190] Sending a network access authentication request to the server, wherein the network access authentication request includes an agricultural sensor identifier, a server identifier, and a digital certificate;
[0191] receiving a response message returned by the server based on the network access authentication request, and identifying the response message;
[0192] When the response message is identified as a passing message, a transmission channel is created between the device and the server;
[0193] Acquire a session key through the transmission channel, and encrypt a preset counter with the session key to obtain a key stream;
[0194] Based on the key stream, determining the encrypted agricultural Internet of Things data;
[0195] Using a preset HMAC key and hash function, a hash calculation is performed on the encrypted agricultural Internet of Things data to generate an HMAC value corresponding to the encrypted agricultural Internet of Things data;
[0196] The encrypted agricultural Internet of Things data and the HMAC value are packaged to generate target data, and the target data is uploaded to the server through the transmission channel.
[0197] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.
[0198] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0199] Based on such understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of each of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the agricultural Internet of Things data transmission device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0200] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0201] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for transmitting data in the Internet of Things, It is characterized in that Applied to agricultural Internet of Things data transmission equipment, the agricultural Internet of Things data transmission equipment is connected to agricultural sensors and servers respectively, and the Internet of Things data transmission method includes: Sending a network access authentication request to the server, wherein the network access authentication request includes an agricultural sensor identifier, a server identifier, and a digital certificate; receiving a response message returned by the server based on the network access authentication request, and identifying the response message; When the response message is identified as a passing message, a transmission channel is created between the device and the server; Acquire a session key through the transmission channel, and encrypt a preset counter with the session key to obtain a key stream; Based on the key stream, determining the encrypted agricultural Internet of Things data; Using a preset HMAC key and hash function, a hash calculation is performed on the encrypted agricultural Internet of Things data to generate an HMAC value corresponding to the encrypted agricultural Internet of Things data; The encrypted agricultural Internet of Things data and the HMAC value are packaged to generate target data, and the target data is uploaded to the server through the transmission channel.
2. The Internet of Things data transmission method according to claim 1, It is characterized in that The sending of the network access authentication request to the server comprises: A network access authentication request is sent to the server through a network security protocol, wherein the network security protocol includes one of the SSL protocol and the TLS protocol or a combination thereof.
3. The Internet of Things data transmission method according to claim 1, It is characterized in that The step of obtaining a session key through the transmission channel and encrypting a preset counter through the session key to obtain a key stream includes: Acquire a session key through the transmission channel, acquire a file path, and import the counter through the file path; The counter is encrypted by the session key to obtain the key stream.
4. The Internet of Things data transmission method according to claim 1, It is characterized in that Determining the encrypted agricultural Internet of Things data based on the key stream includes: Sending a data acquisition request to the agricultural sensor, receiving sensor data returned by the agricultural sensor according to the data acquisition request, and combining the sensor data corresponding to a plurality of the agricultural sensors to obtain the agricultural Internet of Things data; Within a preset time, detecting whether an update instruction sent by the agricultural sensor is received, wherein the update instruction is an instruction to update the agricultural Internet of Things data; If the update instruction is not received within the preset time, the agricultural Internet of Things data is XORed with the key stream to generate encrypted agricultural Internet of Things data.
5. The Internet of Things data transmission method according to claim 1, It is characterized in that The step of packaging the encrypted agricultural Internet of Things data and the HMAC value to generate target data, and uploading the target data to the server through the transmission channel includes: Packing the encrypted agricultural Internet of Things data and the HMAC value to generate the target data; Read the preset upload time and determine whether the current time is the upload time; If the current time is the upload time, the target data is uploaded to the server through the transmission channel.
6. The Internet of Things data transmission method according to claim 1, It is characterized in that After packaging the encrypted agricultural Internet of Things data and the HMAC value to generate target data, and uploading the target data to the server through the transmission channel, the Internet of Things data transmission method further includes: A target file corresponding to the target data is established, and the target data is stored in the target file.
7. The Internet of Things data transmission method according to any one of claims 1 to 6, It is characterized in that The agricultural sensor identifier is the device identifier of the agricultural sensor, and the server identifier is the device identifier of the server; The agricultural sensor includes one or a combination of a soil moisture sensor, a soil temperature sensor, a soil nutrient sensor and a light sensor.
8. An IoT data transmission device, It is characterized in that Applied to agricultural Internet of Things data transmission equipment, the agricultural Internet of Things data transmission equipment is connected to agricultural sensors and servers respectively, including: A sending module, used for sending a network access authentication request to the server, wherein the network access authentication request includes an agricultural sensor identifier, a server identifier and a digital certificate; A receiving module, configured to receive a response message returned by the server based on the network access authentication request, and identify the response message; A creation module, used for creating a transmission channel between the device and the server when the response message is identified as a pass message; An acquisition module, used for acquiring a session key through the transmission channel, and encrypting a preset counter with the session key to obtain a key stream; An encryption module, used to determine the encrypted agricultural Internet of Things data based on the key stream; A generation module, used to use a preset HMAC key and hash function to perform hash calculation on the encrypted agricultural Internet of Things data to generate an HMAC value corresponding to the encrypted agricultural Internet of Things data; The transmission module is used to package the encrypted agricultural Internet of Things data and the HMAC value, generate target data, and upload the target data to the server through the transmission channel.
9. An agricultural Internet of Things data transmission device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the Internet of Things data transmission method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing a computer program. It is characterized in that When the computer program is executed by a processor, the Internet of Things data transmission method according to any one of claims 1 to 7 is implemented.
