Metering instrument software encryption method and system
By encrypting the measuring instrument software, problems in timeliness, reliability and readability in the software are solved, ensuring that the measurement characteristics meet legal measurement requirements, prevent illegal tampering and cheating, and maintain a fair competitive environment in the market.
Patent Information
- Application Number
- CN202411789270.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-03-28
AI Technical Summary
The prior art is difficult to effectively solve the problems of timeliness, reliability and readability in measuring instrument software, especially when it involves legal-related parts, it is difficult to ensure that the metrological characteristics meet legal-based metrological requirements.
A metering instrument software encryption method is adopted to enter the encrypted microcontroller interface through the preset encryption toolkit, select the microcontroller file to be encrypted, configure the file parameter information, and use the preset generation encryption algorithm to encrypt the file and parameter information to ensure that only through the authorized decryption process can be restored to readable information.
Effectively prevent the metering instrument software from being illegally tampered with, prevent cheating, maintain a fair competitive environment in the market, protect the interests of legal enterprises and consumers, and realize all-round encryption protection of the legal part of metering instruments.
Smart Images

Figure CN119720133A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of encryption of measuring instruments, and in particular to a method and system for encrypting software of measuring instruments. Background Art
[0002] With the rapid development of information technology and the continuous improvement of computer software, the scientific and technological content and automation level of various measuring instruments are getting higher and higher, and the software has become the main component of measuring instruments. In traditional metrological verification, calibration, type evaluation and other activities, the main methods are to test the metrological performance, electromagnetic compatibility and environmental testing on the hardware, which cannot find the timeliness, reliability and readability of the measuring instrument software. The measurement software plays a vital role in the accuracy and reliability of the measurement results. The reliability and protection capabilities of the measuring instrument software, especially those related to trade settlement, safety protection, medical and health care, environmental monitoring, resource protection, legal evaluation, fair measurement, etc., which belong to the national legal management, are increasingly highly valued by various countries. Therefore, the control of the measuring instrument software, especially the legal related parts involving the measuring instrument, must be highly valued, and the corresponding anti-cheating and anti-tampering means should be studied to ensure that the metrological characteristics of the measuring instrument meet the legal metrological requirements, which has become a key issue to be solved. Summary of the invention
[0003] In order to overcome the above problems existing in the prior art, the present application provides a measuring instrument software encryption method and system, which adopts the following technical solutions:
[0004] In a first aspect, the present application provides a method for encrypting measuring instrument software, comprising:
[0005] Enter the encryption MCU interface based on the preset encryption toolkit, select the MCU file to be encrypted through the encryption MCU interface, and obtain the MCU file to be encrypted;
[0006] Configure the parameter information of the MCU file to be encrypted. When the parameter information of the MCU file to be encrypted is configured, encrypt the MCU file to be encrypted and the configured parameter information by using a preset encryption algorithm.
[0007] Furthermore, the method of entering the encrypted MCU interface based on a preset encryption toolkit and selecting the MCU file to be encrypted through the encrypted MCU interface includes: judging the file type of the encrypted MCU interface, and when the file type meets the file type that meets the encryption conditions, continuing to configure the parameter information of the MCU file to be encrypted; when the file type does not meet the file type that meets the encryption conditions, reselecting the MCU file to be encrypted.
[0008] Furthermore, the parameter information of the MCU file to be encrypted includes: MCU file to be encrypted, MD5, issuance date, authorizer, unit name, unified social credit code, software serial code, issuing authority, file authorization quantity, and encrypted file output path.
[0009] Furthermore, the encryption algorithm generated by default is used to encrypt the encrypted microcontroller file and the configured parameter information, including: based on the encryption server communicating with the PC through the RJ45 interface, the encryption server receives the encryption request, and uses the built-in encryption algorithm to encrypt the legal part of the measuring instrument.
[0010] Furthermore, the use of a built-in encryption algorithm to encrypt the legal part of the measuring instrument includes:
[0011] Generate a 32-bit binary key;
[0012] Compile the AES algorithm into dynamic libraries for PC, server, and terminal based on the preset language, and deploy the compiled dynamic libraries to PC, server, and terminal devices respectively;
[0013] Obtain parameter information of the microcontroller to be encrypted and its configuration, format the parameter information of the microcontroller to be encrypted and its configuration, and obtain formatted data;
[0014] The formatted data is divided into data blocks of fixed length, and multiple rounds of AES encryption algorithm are performed on each data block.
[0015] In each round of operation, the data block is encrypted using the previously generated and securely stored 32-bit binary key. After multiple rounds of iterations, the original authorization information data block is converted into ciphertext form to obtain the encrypted authorization information.
[0016] Furthermore, the formatted data is divided into data blocks of fixed length, and multiple rounds of AES encryption algorithm are performed on each data block, including:
[0017] Perform key expansion operation on the 32-bit binary key to generate a series of round keys;
[0018] Performing a bitwise XOR operation on the first data block and the first round key, preliminarily mixing the key information with the data block, and obtaining a mixed data block;
[0019] A byte mapping table is predefined, and the function of the byte mapping table is to replace the input value of each byte with the value of another byte;
[0020] For each byte of each mixed data block, byte replacement is performed based on a predefined byte mapping table;
[0021] After the byte replacement is completed, each mixed data block is arranged into a byte matrix, and a row shift operation is performed on each row of the byte matrix based on a specific rule;
[0022] For the byte matrix after the row shift operation, the bytes between columns are mixed by multiplying each column in the mixed data block with a fixed confusion matrix;
[0023] In the last step of each round of encryption (except the last round), the data block that has undergone the previous byte replacement, byte row shift, and column confusion processing is bitwise XORed with the next round key. This step again integrates the key information into the data block, so that the encryption result of each round depends on the current round key and the data block encrypted in the previous round;
[0024] Perform byte replacement and row shift operations on the previous round data blocks to obtain the last data block, perform bitwise XOR operation on the last data block and the last round key to obtain the final encrypted data block.
[0025] In a second aspect, the present application also provides a measuring instrument software encryption system for implementing a measuring instrument software encryption method, including:
[0026] The module for acquiring the MCU file to be encrypted is used to enter the encryption MCU interface based on the preset encryption toolkit, select the MCU file to be encrypted through the encryption MCU interface, and acquire the MCU file to be encrypted;
[0027] The encryption module is used to configure the parameter information of the MCU file to be encrypted. When the parameter information of the MCU file to be encrypted is configured, the MCU file to be encrypted and the configured parameter information are encrypted by using a preset encryption algorithm.
[0028] In a third aspect, the present application provides an electronic device, including:
[0029] One or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions, which, when executed by the device, cause the device to perform the method as described in the first aspect.
[0030] In a fourth aspect, the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer executes the method described in the first aspect.
[0031] In a fifth aspect, the present application provides a computer program, which, when executed by a computer, is used to execute the method described in the first aspect.
[0032] In one possible design, the program in the fifth aspect may be stored in whole or in part on a storage medium packaged together with the processor, or may be stored in whole or in part on a memory not packaged together with the processor.
[0033] This application has the following beneficial effects:
[0034] 1. This application enters the encrypted MCU interface based on a preset encryption toolkit, selects the MCU file to be encrypted through the encrypted MCU interface, and obtains the MCU file to be encrypted; configures the parameter information of the MCU file to be encrypted. When the parameter information of the MCU file to be encrypted is configured, the encrypted MCU file and the configured parameter information are encrypts by using a preset encryption algorithm. This application makes the encrypted data exist in the form of garbled code, which can only be restored to readable information through an authorized decryption process. In the encrypted state, unauthorized modification of the measuring instrument software code or data will destroy the encryption structure. This application can effectively prevent the illegal tampering of the measuring instrument software, prevent cheating during the use of the measuring instrument, maintain a fair competition environment in the market, and protect the interests of legitimate enterprises and consumers.
[0035] 2. During the encryption process, this application relies on the support of the encryption server. This application is based on the encryption server communicating with the PC through the RJ45 interface. The encryption server receives the encryption request and uses the built-in encryption algorithm to encrypt the legal part of the measuring instrument. This application achieves comprehensive encryption protection for the legal part of the measuring instrument through the close integration of hardware and software. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 is an exemplary system architecture diagram to which the embodiments of the present application can be applied;
[0037] Figure 2 This is a flow chart of the measuring instrument software encryption method according to an embodiment of the present application;
[0038] Figure 3 This is a flow chart of encrypting the legal part of the measuring instrument in the embodiment of the present application;
[0039] Figure 4 This is a flowchart of performing multiple rounds of AES encryption algorithm on each data block according to an embodiment of the present application;
[0040] Figure 5 This is a system flow chart of an embodiment of the present application;
[0041] Figure 6 It is a schematic diagram of a computer device according to an embodiment of the present application. DETAILED DESCRIPTION
[0042] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0043] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0044] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0045] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0046] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0047] Terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, Moving Picture Experts Group Audio Layer 3), MP4 (Moving Picture Experts Group Audio Layer IV, Moving Picture Experts Group Audio Layer 4) players, laptop computers and desktop computers, etc.
[0048] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .
[0049] It should be noted that the measuring instrument software encryption method provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the measuring instrument software encryption system is generally set in the server / terminal device.
[0050] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0051] Continue to refer Figure 2 , the figure shows a flow chart of a measuring instrument software encryption method of the present application, the method comprising the following steps:
[0052] Step 201, enter the encryption microcontroller interface based on the preset encryption toolkit, select the microcontroller file to be encrypted through the encryption microcontroller interface, and obtain the microcontroller file to be encrypted.
[0053] In one possible implementation, the preset encryption toolkit contains a series of necessary programs, library files and configuration information for realizing the encryption function of the legal part of the measuring instrument software, ensuring the standardization and security of the encryption process. This application uses the encryption algorithm, interface design and related functional modules integrated in the preset encryption toolkit to conveniently and quickly encrypt the measuring instrument software, while ensuring that the encryption process complies with relevant standards and requirements.
[0054] In a possible implementation, selecting a single-chip computer file to be encrypted through an encrypted single-chip computer interface includes: judging the file type of the encrypted single-chip computer interface, and when the file type meets the file type that meets the encryption conditions, continuing to configure parameter information of the single-chip computer file to be encrypted; when the file type does not meet the file type that meets the encryption conditions, reselecting the single-chip computer file to be encrypted.
[0055] In a possible implementation, the encryption algorithm performs identification processing on files of a specific format to implement encryption of files of a specific format. The file type that meets the encryption condition in the embodiment of the present application is a file in .bin format.
[0056] Step 202, configuring parameter information of the MCU file to be encrypted. When the parameter information of the MCU file to be encrypted is configured, encrypting the MCU file to be encrypted and the configured parameter information by using a preset encryption algorithm.
[0057] In a possible implementation, the parameter information of the MCU file to be encrypted includes: MCU file to be encrypted, MD5, issuance date, authorizer, unit name, unified social credit code, software serial code, issuing authority, file authorization quantity, and encrypted file output path.
[0058] Among them, the MCU file to be encrypted is the main target of encryption, which contains the core code and data of the measuring instrument software. Encrypting it can prevent the software from being illegally copied, tampered with or reverse analyzed, ensure the intellectual property rights of the measuring instrument software are protected, and at the same time ensure the security and stability of the software during operation, prevent the implantation or modification of malicious software, thereby ensuring the normal operation of the measuring instrument and the accuracy of the measurement results.
[0059] MD5 is the hash value of the MCU file to be encrypted, a fixed-length string calculated by a specific algorithm based on the file content. The MD5 value of the file is calculated before encryption and encrypted as part of the parameter information. In the subsequent authorization, transmission or use process, the MD5 value of the file can be calculated again and compared with the MD5 value saved during encryption to verify whether the file has been tampered with. If the two MD5 values are not equal, it means that the file may have been modified during the transmission or storage process, thereby ensuring the integrity of the file and ensuring the consistency and reliability of the measuring instrument software in all links.
[0060] The issuance date records the specific date of software authorization, which helps to manage and track the software authorization cycle.
[0061] The authorizer specifies the individual or entity that authorizes the measuring instrument software. This is very important for responsibility tracing and authority management. If problems or disputes arise during the use of the software, the responsible party can be determined based on the authorizer information.
[0062] The unit name identifies the unit or organization to which the metrological instrument software belongs. This helps to distinguish software assets of different units in multi-unit usage scenarios, and facilitates software management and statistics.
[0063] The unified social credit code is like the "ID number" of an organization, which is a unique code used to identify the identity of a legal person or other organization. In the encryption of measuring instrument software, the unified social credit code can further ensure the accuracy and uniqueness of the unit information and strengthen the identity verification of the unit to which the software belongs.
[0064] Software serial code assigns a unique serial code to each measuring instrument software to distinguish different software copies or versions. Software serial code plays a key role in software authorization, installation and upgrade process. It can help the system identify the legality and version information of the software, ensuring that only authorized and correct version of software can be run on the measuring instrument.
[0065] The issuing authority indicates the body that issues software authorization, usually a department or organization with relevant regulatory powers or qualifications.
[0066] The number of file authorizations specifies the number of times or devices that the software can be used. This parameter information is very important for software distribution and use control, as it can prevent the software from being over-authorized or abused. For example, when using measuring instrument software within an enterprise, the number of file authorizations is set according to the number of licenses purchased to ensure that only devices within the authorized scope can use the software, preventing unauthorized devices from illegally using the software. It also helps enterprises to reasonably manage software resources, control costs, and ensure that the use of software complies with the authorization agreement and the company's management regulations.
[0067] The encrypted file output path specifies where the encrypted file should be stored in the computer system. This helps to easily find and manage encrypted files, and also ensures that the storage location of the encrypted file complies with the system's storage planning and security policies.
[0068] In a possible implementation, the encryption of the encrypted microcontroller file and configuration parameter information by using a preset encryption algorithm includes: based on the encryption server communicating with the PC through the RJ45 interface, the encryption server receives the encryption request, and uses the built-in encryption algorithm to encrypt the legal part of the measuring instrument.
[0069] During the encryption process, this application relies on the support of the encryption server, specifically including: the encryption server of this application is the P311 encryption server, the P311 encryption server communicates with the PC through the RJ45 interface, the encryption server receives the encryption request, and uses the built-in encryption algorithm to encrypt the legal part of the measuring instrument. This application achieves comprehensive encryption protection for the legal part of the measuring instrument through the close integration of hardware and software.
[0070] In a possible implementation, the built-in encryption algorithm is used to encrypt the legal part of the measuring instrument. Figure 3 ,include:
[0071] Step 31, generate a 32-bit binary key;
[0072] Step 32, compile the AES algorithm into dynamic libraries of the PC, server, and terminal based on a preset language, and deploy the compiled dynamic libraries to the PC, server, and terminal devices respectively;
[0073] Step 33, obtaining the parameter information of the single chip microcomputer to be encrypted and the configuration, formatting the parameter information of the single chip microcomputer to be encrypted and the configuration, and obtaining formatted data;
[0074] Step 34, dividing the formatted data into data blocks of fixed length, and performing multiple rounds of AES encryption algorithm on each data block.
[0075] Step 35, in each round of operation, the data block is encrypted using the previously generated and securely stored 32-bit binary key (the corresponding round key is generated by key expansion). After multiple rounds of iterations, the original authorization information data block is converted into ciphertext form to obtain the encrypted authorization information.
[0076] In one possible implementation, the formatted data is divided into fixed-length data blocks, and multiple rounds of AES encryption algorithm are performed on each data block. Figure 4 ,include:
[0077] Step 41, performing a key expansion operation on the 32-bit binary key to generate a series of round keys.
[0078] Step 42, performing a bitwise exclusive OR (XOR) operation on the first data block and the first round key, preliminarily mixing the key information with the data block to obtain a mixed data block; the mixed data block makes the encryption result dependent on the key and the original data, thereby increasing the security of encryption.
[0079] Step 43, pre-define a byte mapping table, the function of the byte mapping table is to replace the input value of each byte with the value of another byte.
[0080] Step 42, for each byte of each mixed data block, byte replacement is performed based on a predefined byte mapping table. For example, a byte value of 0x3A may be replaced with 0x7C after S-box mapping. In this way, the byte distribution of the original data is disrupted, increasing the complexity of the data.
[0081] Step 43, after the byte replacement is completed, each mixed data block is arranged into a byte matrix, and a row shift operation is performed on each row of the byte matrix based on a specific rule. For example, each row is circularly shifted to the left according to a specific rule. The first row remains unchanged, the second row is circularly shifted to the left by 1 byte, the third row is circularly shifted to the left by 2 bytes, and the fourth row is circularly shifted to the left by 3 bytes.
[0082] Step 44, for the byte matrix after the row shift operation, the bytes in the mixed data block are multiplied by a fixed confusion matrix to achieve byte mixing between columns. The bytes in the byte matrix are multiplied by a fixed confusion matrix to achieve byte mixing between columns. The column confusion operation causes the bytes in each column to interact with the bytes in other columns, further disrupting the structure of the data. For MCU data and parameter information, the column confusion operation ensures that even if the value of a byte changes slightly, the change in the entire data block after encryption will spread to other bytes, thereby preventing attackers from cracking encrypted data through local analysis.
[0083] Step 45, in the last step of each round of encryption (except the last round), the data block processed by steps 42-44 is subjected to a bitwise XOR operation with the next round key. This step again incorporates the key information into the data block, so that the result of each round of encryption depends on the current round key and the data block encrypted in the previous round, further increasing the security of the encryption.
[0084] Step 46, perform byte replacement and row shift operations on the previous round data block to obtain the last data block, perform a bitwise XOR operation on the last data block and the last round key to obtain the final encrypted data block.
[0085] This application traverses the data blocks and repeats the above-mentioned AES encryption algorithm multiple rounds of operation process for all divided data blocks (from data block 1 to data block N). Each data block is encrypted independently to ensure the security of the entire authorization data. After the encryption operation on all data blocks, a series of encrypted data blocks will be obtained. These data blocks are combined together to form the final encryption result, that is, the ciphertext form of the authorization information. The ciphertext will be presented in the form of garbled code, without obvious rules and structure, thereby effectively protecting the security of the authorization information during transmission and storage, and preventing it from being illegally obtained and tampered with.
[0086] In a possible implementation, when authorizing the software version of the measuring instrument, the AES encryption algorithm and 32-bit binary key are used, and the dynamic library of the PC, server, and terminal is compiled through the GO language to make it impossible to decompile. The important authorization is converted into garbled code (encrypted) for transmission. After arriving at the destination, the dynamic library is restored (decrypted) in the same way.
[0087] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0088] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0089] Continue to refer Figure 5 The measuring instrument software encryption system described in this embodiment includes:
[0090] The MCU file to be encrypted acquisition module 501 is used to enter the encryption MCU interface based on the preset encryption toolkit, select the MCU file to be encrypted through the encryption MCU interface, and acquire the MCU file to be encrypted;
[0091] The encryption module 502 is used to configure the parameter information of the MCU file to be encrypted. When the parameter information of the MCU file to be encrypted is configured, the MCU file to be encrypted and the configured parameter information are encrypted by using a preset encryption algorithm.
[0092] To solve the above technical problems, the present application also provides a computer device. Figure 6 , Figure 6 This is a basic structural block diagram of the computer device in this embodiment.
[0093] The computer device 6 includes a memory 6a, a processor 6b, and a network interface 6c that are interconnected through a system bus. It should be noted that the figure only shows a computer device 6 with components 6a-6c, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.
[0094] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.
[0095] The memory 6a includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 6a can be an internal storage unit of the computer device 6, such as a hard disk or memory of the computer device 6. In other embodiments, the memory 6a can also be an external storage device of the computer device 6, such as a plug-in hard disk equipped on the computer device 6, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. Of course, the memory 6a can also include both the internal storage unit of the computer device 6 and its external storage device. In this embodiment, the memory 6a is usually used to store the operating system and various application software installed on the computer device 6, such as the program code of the measurement instrument software encryption method, etc. In addition, the memory 6a can also be used to temporarily store various types of data that have been output or are to be output.
[0096] The processor 6b may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 6b is generally used to control the overall operation of the computer device 6. In this embodiment, the processor 6b is used to run the program code stored in the memory 6a or process data, such as running the program code of the measuring instrument software encryption method.
[0097] The network interface 6c may include a wireless network interface or a wired network interface. The network interface 6c is generally used to establish a communication connection between the computer device 6 and other electronic devices.
[0098] The present application also provides another implementation, namely, providing a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a program of a measuring instrument software encryption method, and the measuring instrument software encryption can be executed by at least one processor so that the at least one processor executes the steps of the measuring instrument software encryption method as described above.
[0099] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0100] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.
Claims
1. A method for encrypting measuring instrument software, characterized in that: include: Enter the encryption MCU interface based on the preset encryption toolkit, select the MCU file to be encrypted through the encryption MCU interface, and obtain the MCU file to be encrypted; Configure the parameter information of the MCU file to be encrypted. When the parameter information of the MCU file to be encrypted is configured, encrypt the MCU file to be encrypted and the configured parameter information by using a preset encryption algorithm.
2. The measuring instrument software encryption method according to claim 1, characterized in that: The method enters the encrypted MCU interface based on a preset encryption toolkit and selects the MCU file to be encrypted through the encrypted MCU interface, including: judging the file type of the encrypted MCU interface, and when the file type meets the file type that meets the encryption conditions, continuing to configure the parameter information of the MCU file to be encrypted; when the file type does not meet the file type that meets the encryption conditions, reselecting the MCU file to be encrypted.
3. The measuring instrument software encryption method according to claim 1, characterized in that: The parameter information of the MCU file to be encrypted includes: MCU file to be encrypted, MD5, issuance date, authorizer, unit name, unified social credit code, software serial number, issuing authority, file authorization quantity, and encrypted file output path.
4. The measuring instrument software encryption method according to claim 1, characterized in that: The method of encrypting the single-chip computer file to be encrypted and the parameter information of the configuration by generating a preset encryption algorithm includes: The encryption server communicates with the PC through the RJ45 interface. The encryption server receives the encryption request and uses the built-in encryption algorithm to encrypt the legal part of the measuring instrument.
5. The measuring instrument software encryption method according to claim 4, characterized in that: The use of the built-in encryption algorithm to encrypt the legal part of the measuring instrument includes: Generate a 32-bit binary key; Compile the AES algorithm into dynamic libraries for PC, server, and terminal based on the preset language, and deploy the compiled dynamic libraries to PC, server, and terminal devices respectively; Obtain parameter information of the microcontroller to be encrypted and its configuration, format the parameter information of the microcontroller to be encrypted and its configuration, and obtain formatted data; The formatted data is divided into data blocks of fixed length, and multiple rounds of AES encryption algorithm are performed on each data block. In each round of operation, the data block is encrypted using the previously generated and securely stored 32-bit binary key. After multiple rounds of iterations, the original authorization information data block is converted into ciphertext to obtain the encrypted authorization information.
6. The measuring instrument software encryption method according to claim 5, characterized in that: The formatted data is divided into data blocks of fixed length, and each data block is subjected to multiple rounds of AES encryption algorithm operations, including: Perform key expansion operation on the 32-bit binary key to generate a series of round keys; Performing a bitwise XOR operation on the first data block and the first round key, preliminarily mixing the key information with the data block, and obtaining a mixed data block; A byte mapping table is predefined, and the function of the byte mapping table is to replace the input value of each byte with the value of another byte; For each byte of each mixed data block, byte replacement is performed based on a predefined byte mapping table; After the byte replacement is completed, each mixed data block is arranged into a byte matrix, and a row shift operation is performed on each row of the byte matrix based on a specific rule; For the byte matrix after the row shift operation, the bytes between columns are mixed by multiplying each column in the mixed data block with a fixed confusion matrix; In the last step of each round of encryption (except the last round), the data block that has undergone the previous byte replacement, byte row shift, and column confusion processing is bitwise XORed with the next round key. This step again integrates the key information into the data block, so that the encryption result of each round depends on the current round key and the data block encrypted in the previous round; Perform byte replacement and row shift operations on the previous round data blocks to obtain the last data block, perform bitwise XOR operation on the last data block and the last round key to obtain the final encrypted data block.
7. A measuring instrument software encryption system, used to implement the measuring instrument software encryption method of claims 1-6, characterized in that: include: The module for acquiring the MCU file to be encrypted is used to enter the encryption MCU interface based on the preset encryption toolkit, select the MCU file to be encrypted through the encryption MCU interface, and acquire the MCU file to be encrypted; The encryption module is used to configure the parameter information of the MCU file to be encrypted. When the parameter information of the MCU file to be encrypted is configured, the MCU file to be encrypted and the configured parameter information are encrypted by using a preset encryption algorithm.
8. An electronic device, characterized in that: include: one or more processors; Memory; And one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions, which, when executed by the device, enable the device to perform the steps of the measuring instrument software encryption method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed on a computer, enables the computer to execute the steps of the measuring instrument software encryption method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method for safely upgrading firmware of single-chip microcomputer through near-field communication
CN110955896A
Software encryption method, apparatus and device, and storage medium
CN112597449A
Single-chip microcomputer upgrading method and device, electronic equipment and storage medium
CN117251188A
Method for preventing single-chip microcomputer program from being cracked, single-chip microcomputer and readable storage program
CN118965301A