Disclosure of Invention
In view of the above drawbacks of the prior art, an object of the present invention is to provide a method and a system for processing sensor data, which are used to solve the problems that when a sink node encrypts sensor data, all sensor data needs to be encrypted, and the sensor data lacks a query field, so that a query process is complicated in the prior art.
To achieve the above and other related objects, the present invention provides a sensor data processing method, including:
the method comprises the steps that a sink node obtains sensor data uploaded by a sensor node and an object identifier OID identification prefix of the sensor node;
when a sensor data encryption instruction is received, loading a preset dynamic library file, wherein the dynamic library file comprises a plurality of different sensor data encryption interfaces;
calling a sensor data encryption interface corresponding to the OID identifier prefix in the dynamic library file;
acquiring an interface number of the sensor data encryption interface, and selecting an encryption function corresponding to the interface number;
acquiring a query field corresponding to the OID identification prefix in a preset query field library, adding the OID identification prefix, the serial number of the sensor node and the query field into the sensor data, and encrypting the sensor data through the encryption function;
and after encryption is finished, uploading the sensor data to a preset management node.
Preferably, in the method, the invoking a sensor data encryption interface corresponding to the OID identifier prefix in the dynamic library file specifically includes:
and matching the OID identifier prefix with a preset OID identifier prefix, judging whether the matching is successful, and calling a sensor data encryption interface corresponding to the OID identifier prefix in the dynamic library file if the OID identifier prefix is successfully matched with the preset OID identifier prefix.
Preferably, in the method, the obtaining, in a preset query field library, a query field corresponding to the OID identifier prefix, adding the OID identifier prefix, the serial number of the sensor node, and the query field to the sensor data, and encrypting the sensor data through the encryption function specifically includes:
acquiring key words in query fields corresponding to the OID identifier prefix from a preset query field library, establishing a pointer variable of the OID identifier prefix, storing the address of the key word in the query field corresponding to the OID identifier prefix in the pointer variable of the OID identifier prefix, indirectly reading the key word in the query field corresponding to the OID identifier prefix through the pointer variable of the OID identifier prefix, adding the OID identifier prefix, the serial number of the sensor node and the key word in the query field corresponding to the OID identifier prefix to the sensor data, and encrypting the sensor data through the encryption function.
Preferably, in the method, after the encryption is completed, the uploading the sensor data to a preset management node specifically includes:
after encryption is finished, a preset network mode is obtained, the sensor data are uploaded to a preset management node, and the preset network mode comprises a WIFI network mode, a 4G network mode and a 5G network mode.
Preferably, in the method, after the encryption is completed and the sensor data is uploaded to a preset management node, the method further includes:
and the management node receives and decrypts the sensor data, and adds a unique authority identifier to the sensor data so that the sensor data can be uniquely identified.
The invention provides a sensor data processing system, which comprises a sink node, wherein the sink node comprises:
the acquisition module is used for acquiring sensor data uploaded by a sensor node and an Object Identifier (OID) identification prefix of the sensor node by a sink node;
the loading module is used for loading a preset dynamic library file when a sensor data encryption instruction is received, wherein the dynamic library file comprises a plurality of different sensor data encryption interfaces;
the calling module is used for calling a sensor data encryption interface corresponding to the OID identifier prefix in the dynamic library file;
the selection module is used for acquiring an interface number of the sensor data encryption interface and selecting an encryption function corresponding to the interface number;
the adding module is used for acquiring a query field corresponding to the OID identifier prefix from a preset query field library, adding the OID identifier prefix, the serial number of the sensor node and the query field into the sensor data, and encrypting the sensor data through the encryption function;
and the uploading module is used for uploading the sensor data to a preset management node after encryption is finished.
Preferably, in the system, the invoking module is specifically configured to:
and matching the OID identifier prefix with a preset OID identifier prefix, judging whether the matching is successful, and calling a sensor data encryption interface corresponding to the OID identifier prefix in the dynamic library file if the OID identifier prefix is successfully matched with the preset OID identifier prefix.
Preferably, in the system, the adding module is specifically configured to: acquiring key words in query fields corresponding to the OID identifier prefix from a preset query field library, establishing a pointer variable of the OID identifier prefix, storing the address of the key word in the query field corresponding to the OID identifier prefix in the pointer variable of the OID identifier prefix, indirectly reading the key word in the query field corresponding to the OID identifier prefix through the pointer variable of the OID identifier prefix, adding the OID identifier prefix, the serial number of the sensor node and the key word in the query field corresponding to the OID identifier prefix to the sensor data, and encrypting the sensor data through the encryption function.
Preferably, in the system, the loading module is specifically configured to:
after encryption is finished, a preset network mode is obtained, the sensor data are uploaded to a preset management node, and the preset network mode comprises a WIFI network mode, a 4G network mode and a 5G network mode.
Preferably, in the system, the system further includes the management node, and the management node is configured to receive the sensor data and add a unique authority identifier to the sensor data, so that the sensor data can be uniquely identified.
As described above, the sensor data processing method and system of the present invention have the following beneficial effects:
the sensor data in a certain field are encrypted, so that the problems that when the sensor data are encrypted by the sink node, all the sensor data need to be encrypted, the query field is added, and the sensor data lack the query field and the query process is complicated are solved.
Detailed Description
The application provides a sensor data processing method and system, which are applicable to electronic equipment.
Referring to fig. 1, the present invention provides a sensor data processing method, which is detailed as follows:
s101, a sink node acquires sensor data uploaded by a sensor node and an Object Identifier (OID) identification prefix of the sensor node;
the existing access protocol is responsible for networking and communication between the sink node and the sensor node, the access protocol includes any one of ZigBee, bluetooth, WiFi and LoRa, and the specific access process is not described herein.
The sink node acquires the sensing node identity identifiers uploaded by the sensor nodes, and extracts Object Identifiers (OID) identification prefixes from the sensing node identity identifiers. The total length of the sensing node identity identifier is 120 bits, and the coding structure is as follows: version number + OID identification prefix + manufacturer code + product code. The version number is 8 bits, the OID identifier prefix is 48 bits, the manufacturer code is 24 bits, and the product code is 40 bits. Therefore, after the sink node resolves the identity identifier of the sensing node, the sink node can directly extract the OID identification prefix with 48 bits.
S102, when a sensor data encryption command is received, loading a preset dynamic library file, wherein the dynamic library file comprises a plurality of different sensor data encryption interfaces;
it should be noted that, before S102 or S101, the sink node integrates and encapsulates a plurality of different sensor data encryption interfaces into a dynamic library file to manage the sensor data encryption interfaces.
The dynamic library file stores the corresponding relation between OID identification prefixes and sensor data encryption interfaces, and each OID identification prefix has a unique sensor data encryption interface corresponding to the OID identification prefix.
S103, calling a sensor data encryption interface corresponding to the OID identifier prefix in the dynamic library file;
after loading a preset dynamic library file, the sink node directly calls a sensor data encryption interface corresponding to the OID identifier prefix in the dynamic library file.
S104, acquiring an interface number of the sensor data encryption interface, and selecting an encryption function corresponding to the interface number;
wherein, S104 specifically includes:
and matching the OID identifier prefix with a preset OID identifier prefix, judging whether the matching is successful, and calling a sensor data encryption interface corresponding to the OID identifier prefix in the dynamic library file if the OID identifier prefix is successfully matched with the preset OID identifier prefix.
The preset OID identifier prefix may be set by the user itself or by the system, which is not limited herein.
Wherein the OID identifies a prefix (Object Identifier). Each domain has a unique OID identification prefix of the sensor node. Sensor nodes in different fields have different encryption requirements, for example, sensor nodes in a certain field relate to sensitive private data, so that sensor data acquired by sensor nodes in a certain field need to be encrypted, sensor nodes in partial fields do not relate to sensitive private data, and sensor data acquired by sensor nodes in partial fields do not need to be encrypted.
In the present application, the OID identifier prefix is successfully matched with the preset OID identifier prefix, that is, it is stated that the OID identifier prefix of the sensor node of the uploaded sensor data is the preset OID identifier prefix, and on the premise, the sensor data encryption interface corresponding to the OID identifier prefix is called in the dynamic library file. The beneficial effects are as follows: the sink node only encrypts the sensor data acquired by the sensor node in the preset field, so that the data volume for processing the sensor data can be reduced, the encryption time is saved, and the encryption efficiency is improved.
S105, acquiring a query field corresponding to the OID identifier prefix from a preset query field library, adding the OID identifier prefix, the serial number of the sensor node and the query field into the sensor data, and encrypting the sensor data through the encryption function;
wherein, S105 specifically comprises:
acquiring key words in query fields corresponding to the OID identifier prefix from a preset query field library, establishing a pointer variable of the OID identifier prefix, storing the address of the key word in the query field corresponding to the OID identifier prefix in the pointer variable of the OID identifier prefix, indirectly reading the key word in the query field corresponding to the OID identifier prefix through the pointer variable of the OID identifier prefix, adding the OID identifier prefix, the serial number of the sensor node and the key word in the query field corresponding to the OID identifier prefix to the sensor data, and encrypting the sensor data through the encryption function.
The effect of this is: the key words in the query fields corresponding to the OID identifier prefixes can be directly read through the pointer variables of the OID identifier prefixes, so that the speed of reading the key words can be greatly increased, because the query field library comprises a plurality of pre-stored OID identifier prefixes and a plurality of pre-stored query fields corresponding to the OID identifier prefixes, if the key words in the query fields corresponding to the OID identifier prefixes are obtained again in the pre-set query field library for the second encryption, the situation that the key words occupy too much memory and the speed of reading the key words is influenced occurs, and therefore the key words in the query fields corresponding to the OID identifier prefixes are directly read, and the speed of reading the key words can be greatly increased.
It should be noted that the OID identifier prefix, the number of the sensor node, and the key word in the query field corresponding to the OID identifier prefix are added to the sensor data, and the coding structure of the added sensor data is as follows: like the key words + OID identification prefixes + the serial numbers of the sensor nodes + the sensor data, the relevant sensor data can be quickly searched through the key words.
The query field library comprises a plurality of pre-stored OID identification prefixes and query fields corresponding to the pre-stored OID identification prefixes, and the query fields comprise keywords, types corresponding to the query fields and meanings of the query fields.
Before the convergent node leaves a factory, a preset query field library is written into a storage directory.
And the sink node is connected with the management node at preset time intervals and downloads the new query field so as to update the preset query field library.
It should be noted that, the sink node obtains the frequency of the query field, and uses the query field with the frequency higher than the preset value, and the corresponding updating mode is to connect the management node, and the sink node downloads and updates the new query field after receiving the confirmed message uploaded by the mobile terminal. The sink node uses the query field with the frequency not higher than the preset value, the corresponding updating mode is the connection management node, the new query field is automatically downloaded and automatically updated, and therefore the sink node is not required to be disturbed.
It should be noted that, the keywords in the query fields corresponding to the OID identifier prefixes in different fields are different, for example, when the OID identifier prefix is the OID identifier prefix of the sensor node in the information security field, the keywords in the query fields corresponding to the OID identifier prefix are: keywords in a query field of the information security domain. The key words in the query field of the information security field comprise names, identity card numbers and face images.
For convenience of explanation, the following are exemplified:
for example, a sensor node of a certain security system is provided with an image sensor, a face image acquired by the image sensor of the sensor node in the system belongs to personal privacy, and query privacy relates to information security, so that the face image belongs to keywords in a query field in the field of information security.
For example, a sensor node of a security system further has an identity card sensor, and a name and an identity card number acquired by the identity card sensor of the sensor node in the system belong to personal privacy, and query privacy relates to information security, so that the name and the identity card number also belong to keywords in a query field in the field of information security.
For example, when the OID identifier prefix is the OID identifier prefix of the sensor node in the logistics field, the keyword in the query field corresponding to the OID identifier prefix is: keywords in the query field of the logistics domain. The keywords in the query field of the logistics field comprise addressee, contact telephone, addressee and weighing information.
For example, a sensor node of a certain internet of things system is provided with an image sensor, and the sensor node image sensor in the system reads a bar code to acquire information that a recipient address, a contact phone number and a recipient belong to the logistics field, so that the recipient address, the contact phone number and the recipient are called as keywords in an inquiry field of the logistics field.
For example, a sensor node of a certain internet of things system is also provided with a weighing sensor, weighing information acquired by the sensor node in the system belongs to information of goods, and inquiry weighing information relates to the field of logistics, so that the weighing information belongs to keywords in an inquiry field of the field of logistics.
And S106, after encryption is finished, uploading the sensor data to a preset management node.
Preferably, S106, specifically:
after encryption is finished, a preset network mode is obtained, the sensor data are uploaded to a preset management node, and the preset network mode comprises a WIFI network mode, a 4G network mode and a 5G network mode.
Preferably, after S106, the method further comprises:
and the management node receives and decrypts the sensor data, and adds a unique authority identifier to the sensor data so that the sensor data can be uniquely identified.
It should be noted that, after the management node receives and decrypts the sensor data, and adds a unique authority identifier to the sensor data, so that the sensor data can be uniquely identified, the method further includes:
the management node acquires the OID identification prefix and the query field in the sensor data;
the management node acquires shared data of a client account with the highest query authority, wherein the shared data comprises a shared account, an OID (object identifier) prefix corresponding to the shared account and shared time corresponding to the shared account;
the management node extracts an OID identifier prefix corresponding to the shared account from the shared data, and judges whether the OID identifier prefix corresponding to the shared account is the same as the OID identifier prefix in the sensor data;
when the OID identifier prefix corresponding to the shared account is the same as the OID identifier prefix in the sensor data, the management node sends shared inquiry authority information to the shared account, wherein the shared inquiry authority information comprises the name of the user of the shared account about to share inquiry authority;
and the management node receives a confirmation instruction returned by the client of the shared account aiming at the shared inquiry authority information, and carries out inquiry authority authorization on the shared account within the sharing time so that the shared account can inquire the sensor data by adopting the inquiry field. Thus, the management node can quickly complete the setting of the inquiry authority.
In the embodiment of the invention, the sensor data in a certain field is encrypted, so that the problem that all the sensor data need to be encrypted when the sensor data is encrypted is solved, the encryption efficiency of the sensor data is improved, the problem that the query process of the sensor data is complicated is solved by adding the query field, and the query efficiency of the sensor data is improved.
Referring to fig. 2, the present invention provides a sensor data processing system, which includes a sink node and a management node, where the sink node includes:
the acquisition module is used for acquiring sensor data uploaded by a sensor node and an Object Identifier (OID) identification prefix of the sensor node by a sink node;
the loading module is used for loading a preset dynamic library file when a sensor data encryption instruction is received, wherein the dynamic library file comprises a plurality of different sensor data encryption interfaces;
the calling module is used for calling a sensor data encryption interface corresponding to the OID identifier prefix in the dynamic library file;
the selection module is used for acquiring an interface number of the sensor data encryption interface and selecting an encryption function corresponding to the interface number;
the adding module is used for acquiring a query field corresponding to the OID identifier prefix from a preset query field library, adding the OID identifier prefix, the serial number of the sensor node and the query field into the sensor data, and encrypting the sensor data through the encryption function;
the uploading module is used for uploading the sensor data to a preset management node after encryption is finished;
the management node is configured to: receiving and decrypting the sensor data, and acquiring the OID identifier prefix and the query field in the sensor data;
obtaining shared data of a client account with the highest query authority, wherein the shared data comprises a shared account, an OID (object identifier) prefix corresponding to the shared account and shared time corresponding to the shared account; in that
Extracting an OID (object identifier) prefix corresponding to the shared account from the shared data, and judging whether the OID prefix corresponding to the shared account is the same as the OID prefix in the sensor data;
if the sharing inquiry authority information is the same as the user name of the sharing account, sending the sharing inquiry authority information to the sharing account, wherein the sharing inquiry authority information comprises the user name of the sharing account which is to share the inquiry authority;
and receiving a confirmation instruction corresponding to the sharing inquiry authority information, and performing inquiry authority authorization on the sharing account within the sharing time so that the sharing account can inquire the sensor data by adopting the inquiry field.
In summary, the present invention encrypts sensor data in a certain field, solves the problem that all sensor data need to be encrypted when encrypting sensor data, is beneficial to improving the encryption efficiency of sensor data, adds query fields, solves the problem that the query process of sensor data is complicated, and is beneficial to improving the query efficiency of sensor data. Therefore, the invention effectively overcomes various defects in the prior art and has high industrial utilization value.
The foregoing embodiments are merely illustrative of the principles and utilities of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or change the above-mentioned embodiments without departing from the spirit and scope of the present invention. Accordingly, it is intended that all equivalent modifications or changes which can be made by those skilled in the art without departing from the spirit and technical spirit of the present invention be covered by the claims of the present invention.