Visual displacement program encryption authorization method and system
By combining the serial numbers of the camera and the USB flash drive to construct a device identifier, and using multiple serial numbers and encryption mechanisms to generate an authorization code, the problem of forged authorization in visual displacement programs is solved, thus improving operational security and legitimacy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-30
- Publication Date
- 2026-04-21
AI Technical Summary
Existing methods for encrypting and authorizing visual displacement programs are difficult to identify forged authorizations and have poor operational security. Software serial number verification is easily decompiled, hardware dongles rely on a single hardware device and are easily simulated, and file encryption lacks support from high-strength national cryptographic algorithms.
The device identifier is constructed by combining the serial numbers of the camera and the USB flash drive. A device identifier digest value is generated through a preset encoding algorithm. Multiple serial number authorization mechanisms and multiple encryption mechanisms are adopted to generate an authorization code and embed it into the program startup process, and verify the matching of hardware information and authorization file in real time.
The security of the visual displacement program is improved by using dual physical binding and multiple encryption mechanisms to ensure the unforgeability of the authorization file and the legitimacy of the hardware, thereby achieving mandatory license control.
Smart Images

Figure CN121902105A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information security technology, and in particular to a visual displacement program encryption authorization method and system. Background Technology
[0002] Visual displacement programs are used in visual displacement monitoring systems. They mainly use high-precision image processing algorithms to automatically identify, track, and calculate the displacement of targets, enabling engineering structure monitoring, slope stability detection, and reservoir dam safety assessment. However, with the widespread distribution and deployment of these programs, the algorithms face the risk of being illegally copied, cracked, or reverse engineered. Therefore, improving the operational security of visual displacement programs has become a technical problem that needs further research.
[0003] Currently, existing technologies typically employ methods such as software serial number verification, hardware dongle binding, and file encryption. However, software serial number verification, which relies on code logic to determine user authorization, is easily decompiled or its logic modified to bypass the verification mechanism. Hardware dongle binding, on the other hand, depends solely on a single hardware serial number, allowing attackers to forge authorization by simulating or copying hardware information. File encryption lacks strong support from national cryptographic algorithms, posing a risk of key exposure. Therefore, existing encryption and authorization methods struggle to detect forged authorizations, resulting in poor security for visually manipulated programs. Summary of the Invention
[0004] To address the aforementioned issues, this invention proposes a method and system for encrypting and authorizing visual displacement programs. This method combines multiple serial number authorization mechanisms and multiple encryption mechanisms to encrypt and authorize visual displacement programs, thereby improving the operational security of visual displacement programs.
[0005] To achieve the above objectives, embodiments of the present invention provide an encrypted authorization method for a visual displacement program, comprising: constructing a device identifier based on a pre-acquired camera serial number and USB flash drive serial number; calculating a first device identifier digest value based on a preset encoding algorithm and the device identifier; generating an authorization request file based on the first device identifier digest value; generating a public key and a private key based on the authorization request file using a preset key algorithm; signing and encrypting the first device identifier digest value using the public key and the private key to obtain an authorization code; saving the authorization code to an authorization file; whenever the visual displacement program starts, reading the current camera serial number, the current USB flash drive serial number, and the current authorization file; calculating a second device identifier digest value using the current camera serial number and the current USB flash drive serial number; decrypting and verifying the current authorization file using the public key and the private key to obtain a decryption verification value; and authorizing the operation of the visual displacement program using the private key if the second device identifier digest value matches the first device identifier digest value.
[0006] This invention proposes an encrypted authorization method for visual displacement programs. It combines the serial numbers of both the camera and the USB flash drive to construct a device identifier, achieving dual physical binding. A preset key algorithm is used to sign and encrypt the device identifier digest to generate an authorization code. Verification logic is embedded in the program startup process, ensuring the authorization file has cryptographically strong unforgeability. Finally, real-time verification during startup checks whether the current hardware information matches the encrypted information in the authorization file, achieving mandatory permission control during program execution. Thus, this method combines a multi-serial number authorization mechanism and a multi-encryption mechanism to encrypt and authorize visual displacement programs, improving their operational security.
[0007] Furthermore, a device identifier is constructed based on the pre-acquired camera serial number and USB flash drive serial number. Based on a preset encoding algorithm and the device identifier, a first device identifier digest value is calculated, and an authorization request file is generated according to the first device identifier digest value. This includes: acquiring the camera serial number and USB flash drive serial number; concatenating the camera serial number and USB flash drive serial number to obtain the device identifier; hashing the device identifier using a preset encoding algorithm to obtain the first device identifier digest value; and encapsulating the first device identifier digest value to generate an authorization request file.
[0008] In the above scheme, the camera serial number and the USB flash drive serial number are concatenated to construct unique hardware device identification information for both the camera and the USB flash drive. Then, the device identification is hashed to generate a first device identifier digest value, which is used to generate the authorization request file. Thus, by constructing a dual physical binding and hiding the serial number to generate a unified first device identifier digest value, the uniqueness of the identity is guaranteed, and a reliable data foundation is provided for subsequent encryption processing, which helps improve the operational security of the visual displacement program.
[0009] Furthermore, based on the authorization request file, a public key and a private key are generated using a preset key algorithm. The first device identifier digest value is then signed and encrypted using the public key and the private key to obtain an authorization code. The authorization code is then saved to an authorization file. This process includes: randomly selecting an integer within a preset value range as the private key; calculating the corresponding public key using the preset key algorithm and the private key; signing the first device identifier digest value using the private key based on a preset signature algorithm to obtain a signature value; and encrypting the signature value and the first device identifier digest value using the public key based on a preset encryption algorithm to obtain an authorization code. The authorization code is then saved to an authorization file, which is stored on a USB flash drive.
[0010] In the above scheme, a public and private key pair is generated using a preset key algorithm. Then, the private key is used to sign the first device identifier digest value. Finally, the public key is used to encrypt both the signature value and the original digest, generating the final authorization code and saving it to the authorization file. Therefore, a multi-layered encryption mechanism is proposed. This mechanism strongly binds the private key to the unique first device identifier digest value and uses the public key for encryption to ensure the confidentiality of the authorization information. This makes the final authorization file an encrypted and authoritative digitally signed container, achieving encrypted authorization of the visual displacement program by combining a multi-serial number authorization mechanism and a multi-layered encryption mechanism, thus improving the operational security of the visual displacement program.
[0011] Furthermore, whenever the visual displacement program starts, it reads the current camera serial number, the current USB flash drive serial number, and the current authorized file, calculates the second device identifier digest value, and decrypts and verifies the current authorized file using a public key and a private key to obtain a decryption verification value. This includes: whenever the visual displacement program starts, reading the current camera serial number and the current USB flash drive serial number, concatenating the current camera serial number and the current USB flash drive serial number, and calculating the second device identifier digest value using a preset encoding algorithm; based on the preset decryption algorithm, decrypting the current authorized file using the private key to obtain the signature value and the first device identifier digest value corresponding to the current authorized file; and verifying the signature value using the public key to obtain the decryption verification value.
[0012] In the above scheme, when the visual displacement program starts, it calculates the second device identifier digest value of the current device in real time. Then, it uses the private key to decrypt the authorization file and uses the public key to verify the decrypted signature value to obtain the decryption verification value. Therefore, a multi-layered encryption mechanism and a two-way local verification process are proposed to verify both the legitimacy of the hardware and the authenticity and integrity of the authorization file. This achieves encrypted authorization of the visual displacement program by combining a multi-serial number authorization mechanism and a multi-layered encryption mechanism, thereby improving the operational security of the visual displacement program.
[0013] Furthermore, the visual displacement program includes: during the compilation of the visual displacement program, encrypting the core module of the visual displacement program using a randomly generated session key to obtain a ciphertext module file; executing the step of generating a public key and a private key based on an authorization request file using a preset key algorithm, and signing and encrypting the first device identifier digest value using the public key and the private key to obtain an authorization code, and saving the authorization code to the authorization file, including: generating a session public key and a session private key using a preset key algorithm, encrypting the session key using the session public key based on a preset encryption algorithm to obtain a key authorization code, and saving the key authorization code to the authorization file.
[0014] In the above scheme, when compiling the visual displacement program, the core module of the visual displacement program is encrypted using a randomly generated session key. This ensures that the core module is in a ciphertext state in the final distributed program body. Even if an attacker obtains all program files, they cannot directly obtain the algorithm logic through static disassembly or decompilation. This achieves the separation and re-protection of key and authorization binding, which helps to improve the operational security of the visual displacement program.
[0015] Furthermore, based on the decryption verification value, if the second device identifier digest value is consistent with the first device identifier digest value, then the operation of the visual displacement program is authorized through the private key, including: if the decryption verification value meets the preset signature verification requirements, then the second device identifier digest value is compared with the first device identifier digest value; if the second device identifier digest value is consistent with the decryption verification value, then the key authorization code is decrypted through the session private key to obtain the session key, and the core module of the visual displacement program is obtained by decrypting the ciphertext module file through the session key, so as to authorize the operation of the visual displacement program.
[0016] In the above scheme, only after the signature information verification and authorization verification are passed can the session key be obtained by decrypting with the session private key. This key is then used to further decrypt the core module of the visual displacement program and authorize its operation. Thus, a multi-serial number authorization mechanism and a multi-encryption mechanism are combined to encrypt and authorize the visual displacement program, improving its operational security.
[0017] Furthermore, this embodiment of the invention provides a visual displacement program encryption authorization method, which further includes: if the camera serial number or USB flash drive serial number is updated, the authorization request file and the authorization file are marked as invalid.
[0018] In the above scheme, updating the camera serial number or USB flash drive serial number will cause the authorization request file and authorization file to be marked as invalid, enabling authorization management to respond to changes in the actual physical environment, ensuring the flexibility, controllability and security of the multi-serial number authorization mechanism and multi-encryption mechanism, and helping to improve the operational security of the visual displacement program.
[0019] This invention also provides a visual displacement program encryption authorization system, comprising: an authorization request file generation module, configured to construct a device identifier based on a pre-acquired camera serial number and USB flash drive serial number, and calculate a first device identifier digest value based on a preset encoding algorithm and the device identifier, and generate an authorization request file based on the first device identifier digest value; an encryption module, configured to generate a public key and a private key based on the authorization request file using a preset key algorithm, and sign and encrypt the first device identifier digest value using the public key and private key to obtain an authorization code, and save the authorization code to an authorization file; a decryption module, configured to read the current camera serial number, the current USB flash drive serial number, and the current authorization file whenever the visual displacement program starts, calculate a second device identifier digest value using the current camera serial number and the current USB flash drive serial number, and decrypt and verify the current authorization file using the public key and private key to obtain a decryption verification value; and an authorization module, configured to authorize the operation of the visual displacement program using the private key if the second device identifier digest value matches the first device identifier digest value based on the decryption verification value.
[0020] This invention proposes a visual displacement program encryption authorization system. It combines the serial numbers of both the camera and the USB flash drive to construct a device identifier, achieving dual physical binding. A preset key algorithm is used to sign and encrypt the device identifier digest to generate an authorization code. Verification logic is embedded in the program startup process, ensuring the authorization file has cryptographically strong unforgeability. Finally, real-time verification during startup checks whether the current hardware information matches the encrypted information in the authorization file, achieving mandatory permission control during program execution. Thus, this system combines multiple serial number authorization mechanisms and multiple encryption mechanisms to encrypt and authorize visual displacement programs, improving their operational security.
[0021] Furthermore, the encryption module includes: a public and private key generation unit, used to randomly select an integer within a preset value range as the private key, and calculate the public key corresponding to the private key using a preset key algorithm and the private key; a signature unit, used to sign the first device identifier digest value using the private key based on a preset signature algorithm to obtain a signature value; and an authorization code generation unit, used to encrypt the signature value and the first device identifier digest value using the public key based on a preset encryption algorithm to obtain an authorization code, and save the authorization code to an authorization file, wherein the authorization file is stored on a USB flash drive.
[0022] Furthermore, the decryption module includes: a device identifier digest value calculation unit, used to read the current camera serial number and the current USB flash drive serial number whenever the visual displacement program starts, concatenate the current camera serial number and the current USB flash drive serial number, and calculate the second device identifier digest value using a preset encoding algorithm; a signature value decryption unit, used to decrypt the current authorization file using a private key based on a preset decryption algorithm to obtain the signature value and the first device identifier digest value corresponding to the current authorization file; and a signature value verification unit, used to verify the signature value using a public key to obtain the decryption verification value. Attached Figure Description
[0023] Figure 1 This is a flowchart illustrating the steps of a visual displacement program encryption authorization method according to a certain embodiment of the present invention; Figure 2 This is a schematic diagram of the module structure of a visual displacement program encryption authorization system provided in a certain embodiment of the present invention. Detailed Implementation
[0024] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0025] Example 1 See Figure 1 , Figure 1 This is a flowchart illustrating the steps of a visual displacement program encryption authorization method according to a certain embodiment of the present invention. Figure 1 As shown in the figure, this embodiment of the invention proposes a visual displacement program encryption authorization method, including steps 101 to 104, each step of which is as follows: Step 101: Construct a device identifier based on the pre-acquired camera serial number and USB flash drive serial number, and calculate a first device identifier digest value based on a preset encoding algorithm and the device identifier, and generate an authorization request file based on the first device identifier digest value; Step 102: Based on the authorization request file, generate a public key and a private key using a preset key algorithm, and use the public key and private key to sign and encrypt the first device identifier digest value to obtain an authorization code, and save the authorization code to the authorization file; Step 103: Whenever the visual displacement program starts, read the current camera serial number, the current USB flash drive serial number, and the current authorized file. Calculate the second device identifier digest value using the current camera serial number and the current USB flash drive serial number, and decrypt and verify the current authorized file using the public key and private key to obtain the decryption verification value. Step 104: Based on the decryption verification value, if the second device identifier digest value is consistent with the first device identifier digest value, then the operation of the visual displacement program is authorized through the private key.
[0026] One specific implementation involves collecting hardware information and extracting the corresponding serial number. In this embodiment, the serial number corresponding to the hardware information includes the camera serial number and the USB flash drive serial number, with each hardware device corresponding to a unique serial number. Then, the camera serial number and the USB flash drive serial number are concatenated to obtain a device identifier. This device identifier is then encoded using a preset encoding algorithm to obtain a first device identifier digest value. This first device identifier digest value is then encapsulated into an authorization request file. In this embodiment, the preset encoding algorithm uses a hash algorithm such as SHA-256. In this embodiment, an authorization server can be set up to perform the signature encryption and verification / decryption process. After receiving the authorization request file, the authorization server starts the signature encryption program, generates a public key and a private key using a preset key algorithm. In this embodiment, the preset key algorithm uses the national cryptographic algorithm SM2. The private key is used for signing, and then the public key is used for encryption to obtain the authorization code. The public key can be reused. The authorization code is saved to an authorization file for subsequent signature verification. The authorization file is typically stored on a USB drive, while the private key is stored on the authorization server. Whenever the visual displacement program starts, the authorization server reads the current camera serial number, the current USB drive serial number, and the current authorization file. It then calculates a second device identifier digest value using the current camera and USB drive serial numbers. The authorization file is then decrypted and verified using the public and private keys to obtain a decryption verification value. If the decryption verification value meets the preset signature verification requirements, the second device identifier digest value is compared with the first device identifier digest value. If they match, the hardware serial number matches and the authorization is valid. The visual displacement program is then authorized to continue execution using the private key. If they do not match, the hardware serial number does not match or the authorization is invalid. The visual displacement program immediately terminates and displays a "Authorization verification failed" message.
[0027] This invention proposes an encrypted authorization method for visual displacement programs. It combines the serial numbers of both the camera and the USB flash drive to construct a device identifier, achieving dual physical binding. A preset key algorithm is used to sign and encrypt the device identifier digest to generate an authorization code. Verification logic is embedded in the program startup process, ensuring the authorization file has cryptographically strong unforgeability. Finally, real-time verification during startup checks whether the current hardware information matches the encrypted information in the authorization file, achieving mandatory permission control during program execution. Thus, this method combines a multi-serial number authorization mechanism and a multi-encryption mechanism to encrypt and authorize visual displacement programs, improving their operational security.
[0028] A preferred embodiment involves constructing a device identifier based on a pre-acquired camera serial number and USB flash drive serial number, and calculating a first device identifier digest value based on a preset encoding algorithm and the device identifier, and generating an authorization request file based on the first device identifier digest value. The method includes: acquiring the camera serial number and USB flash drive serial number; concatenating the camera serial number and USB flash drive serial number to obtain the device identifier; hashing the device identifier using a preset encoding algorithm to obtain the first device identifier digest value; and encapsulating the first device identifier digest value to generate an authorization request file.
[0029] One preferred implementation involves calling the camera interface to obtain the camera serial number, denoted as Cam_SN, and simultaneously calling the API to obtain the USB flash drive serial number, denoted as USB_SN. To ensure the uniqueness of the identification process, the camera serial number and the USB flash drive serial number are concatenated to generate a unique device identifier, expressed as: The device identifier represents a pairing of a camera and a USB flash drive. Then, a hash algorithm is used to hash the device identifier to obtain a first device identifier digest value. In this embodiment, the SHA-256 algorithm is used, and the expression is: This hash value represents the first device identifier digest value, which can uniquely represent the device identity, but does not expose the specific serial number information, thus ensuring security; finally, the first device identifier digest value is encapsulated to generate an authorization request file, denoted as license_request.dat; For example, in a certain application scenario, assuming the acquired camera serial number Cam_SN is 123 and the USB flash drive serial number USB_SN is 456, the device identifier obtained by concatenating them is "123-456". Then, the device identifier is hashed to obtain the first device identifier digest value: H = 3A7BD3E1A1B2C3D4E5F60123456789AB; then write H to license_request.dat.
[0030] In the above scheme, the camera serial number and the USB flash drive serial number are concatenated to construct unique hardware device identification information for both the camera and the USB flash drive. Then, the device identification is hashed to generate a first device identifier digest value, which is used to generate the authorization request file. Thus, by constructing a dual physical binding and hiding the serial number to generate a unified first device identifier digest value, the uniqueness of the identity is guaranteed, and a reliable data foundation is provided for subsequent encryption processing, which helps improve the operational security of the visual displacement program.
[0031] A preferred embodiment involves generating a public key and a private key based on an authorization request file using a preset key algorithm, signing and encrypting a first device identifier digest value using the public and private keys to obtain an authorization code, and saving the authorization code to an authorization file. The process includes: randomly selecting an integer within a preset numerical range as the private key; calculating the corresponding public key using the preset key algorithm and the private key; signing the first device identifier digest value using the private key based on a preset signature algorithm to obtain a signature value; encrypting the signature value and the first device identifier digest value using the public key based on a preset encryption algorithm to obtain the authorization code, and saving the authorization code to an authorization file stored on a USB flash drive.
[0032] In one preferred implementation, after the authorization request file is identified in the authorization server, a signature encryption program is initiated. To ensure the security and uniqueness of the authorization verification process, this embodiment of the invention uses the SM2 elliptic curve public-key cryptography algorithm, a national cryptographic algorithm standard, to calculate the public and private keys and execute the signature encryption program. Specifically, firstly, based on the SM2 elliptic curve parameters defined in existing standards... In this embodiment, These are the basic parameters for the SM2 elliptic curve. It is the prime modulus of a finite field. It is the equation of an elliptic curve. The coefficient; It is the base point of the elliptic curve, a specific point on the elliptic curve, used to generate the public key; It is the order of the base point G, satisfying The smallest positive integer, It is the point at infinity of the elliptic curve; then a random integer is selected as the private key, represented as... ,in, It's worth noting that the order n of the base point G is a standard fixed parameter of the SM2 algorithm, not a user-defined value; it is a large prime number of 256 bits. Then, the public key corresponding to the private key is calculated using curve dot product, expressed as: In the formula, As the base point; Let G be the order of the base point; The generated public key can be represented as ,in, Let be the coordinates of a point on the elliptic curve. The x-coordinate component of this point. The vertical axis component, together with the other component, uniquely determines the position of the public key on the elliptic curve specified by SM2. Then, using the private key hash digest Perform SM2 signing operation to generate signature value. The expression is as follows: ; ; In the formula, It is the first device identifier digest value The data is processed again and used as input parameters for the signature algorithm, which are then used for subsequent calculations of elliptic curve points. These are random numbers used for point operations on elliptic curves to ensure the security of signatures. The x-coordinate component in the coordinates of the curve points; Let be the order of the SM2 elliptic curve.
[0033] Finally, the signature value Compared with the first device identifier summary value Encryption is performed to obtain authorization code C. The calculation process is as follows: ; Save the authorization code C to the authorization file license.dat, which includes legitimate hardware information that has been signed and encrypted by the authorization server. Finally, write the authorization file license.dat to the root directory of the USB flash drive. This authorization file can only be successfully decrypted if the device camera serial number, USB flash drive serial number and encrypted information match. Otherwise, the program will automatically refuse to run.
[0034] In the above scheme, a public and private key pair is generated using a preset key algorithm. Then, the private key is used to sign the first device identifier digest value. Finally, the public key is used to encrypt both the signature value and the original digest, generating the final authorization code and saving it to the authorization file. Therefore, a multi-layered encryption mechanism is proposed. This mechanism strongly binds the private key to the unique first device identifier digest value and uses the public key for encryption to ensure the confidentiality of the authorization information. This makes the final authorization file an encrypted and authoritative digitally signed container, achieving encrypted authorization of the visual displacement program by combining a multi-serial number authorization mechanism and a multi-layered encryption mechanism, thus improving the operational security of the visual displacement program.
[0035] In a preferred embodiment, whenever the visual displacement program starts, the current camera serial number, the current USB flash drive serial number, and the current authorized file are read, and a second device identifier digest value is calculated. The current authorized file is then decrypted and verified using a public key and a private key to obtain a decryption verification value. This process includes: whenever the visual displacement program starts, reading the current camera serial number and the current USB flash drive serial number, concatenating the current camera serial number and the current USB flash drive serial number, and calculating the second device identifier digest value using a preset encoding algorithm; based on the preset decryption algorithm, decrypting the current authorized file using the private key to obtain the signature value and the first device identifier digest value corresponding to the current authorized file; and verifying the signature value using the public key to obtain the decryption verification value.
[0036] In one preferred implementation, whenever the visual displacement program is started, the camera serial number Cam_SN and the USB flash drive serial number USB_SN of the current device are read, reassembled, and the second device identifier digest value is calculated, represented as: Then, the license file license.dat is read from the USB drive, and the license file is decrypted using the SM2 private key to obtain the first device identifier digest value and the signature value. , represented as: In the formula, To match the encrypted public key stored on the authorization server The paired private key is the public key and private key pair generated during the encryption process in step 102; then the signature value is verified using the SM2 public key, as shown below: In the formula, This is the public key stored on the authorization server, used to verify the validity of the signature.
[0037] For example, when the visual displacement program starts, it calculates the second device identifier digest value of the current device, H'=SM2("123-456")=3A7BD3E1A1B2C3D4E5F60123456789AB; it reads the license file license.dat from the USB flash drive and decrypts the license file using the SM2 private key to obtain... And the signature value (r, s), and then use the public key. Perform SM2 verification on the signature value (r,s).
[0038] In the above scheme, when the visual displacement program starts, it calculates the second device identifier digest value of the current device in real time. Then, it uses the private key to decrypt the authorization file and uses the public key to verify the decrypted signature value to obtain the decryption verification value. Therefore, a multi-layered encryption mechanism and a two-way local verification process are proposed to verify both the legitimacy of the hardware and the authenticity and integrity of the authorization file. This achieves encrypted authorization of the visual displacement program by combining a multi-serial number authorization mechanism and a multi-layered encryption mechanism, thereby improving the operational security of the visual displacement program.
[0039] A preferred embodiment of the visual displacement program includes: during compilation, encrypting the core module of the visual displacement program using a randomly generated session key to obtain a ciphertext module file; and during execution of the step of generating a public key and a private key based on an authorization request file using a preset key algorithm, signing and encrypting a first device identifier digest value using the public key and the private key to obtain an authorization code, and saving the authorization code to an authorization file, the step includes: generating a session public key and a session private key using a preset key algorithm, encrypting the session key using the session public key based on a preset encryption algorithm to obtain a key authorization code, and saving the key authorization code to an authorization file.
[0040] One preferred implementation involves encrypting the visual displacement program using AES symmetric encryption during compilation. Specifically, a randomly generated session key is used. The core module binary file is encrypted to generate a ciphertext module file. Then, the key authorization code obtained by encrypting the ciphertext module file using the SM2 algorithm is embedded in the authorization file `license.dat`. During encryption, a session public key and a session private key are generated. At runtime, the program first reads and verifies the authorization file `license.dat` using the session public key. If the authorization verification is successful, the session private key is used to decrypt the file to obtain the session key. and session key The core module is dynamically loaded and decrypted. It is worth mentioning that the entire decryption process is carried out only in memory, without generating any intermediate plaintext files. When authorization verification fails, the core module remains encrypted, and the program cannot be executed.
[0041] In the above scheme, when compiling the visual displacement program, the core module of the visual displacement program is encrypted using a randomly generated session key. This ensures that the core module is in a ciphertext state in the final distributed program body. Even if an attacker obtains all program files, they cannot directly obtain the algorithm logic through static disassembly or decompilation. This achieves the separation and re-protection of key and authorization binding, which helps to improve the operational security of the visual displacement program.
[0042] In a preferred embodiment, based on the decryption verification value, if the second device identifier digest value is consistent with the first device identifier digest value, then the operation of the visual displacement program is authorized through the private key. This includes: if the decryption verification value meets the preset signature verification requirements, then comparing the second device identifier digest value with the first device identifier digest value; if the second device identifier digest value is consistent with the decryption verification value, then decrypting the key authorization code through the session private key to obtain the session key, and then decrypting the ciphertext module file through the session key to obtain the core module of the visual displacement program, thereby authorizing the operation of the visual displacement program.
[0043] In one preferred implementation, before performing the comparison between the second device identifier digest value and the decryption verification value, it is first determined whether the signature verification was successful. Specifically, after obtaining the decryption verification value, the first device identifier digest value H, the signature value (r, s), and the encryption public key stored on the authorization server are extracted from the decryption verification value. Then calculate the verification parameters using the encrypted public key. Perform an SM2 signature operation on the first device identifier digest value H, and obtain the verification value R by combining elliptic curve point arithmetic. Perform a matching verification: if R matches the r in the signature value, the signature verification passes; otherwise, the verification fails. If the signature verification fails, the program displays "Authorization file has been tampered with" and terminates. If the signature verification passes, then compare... ,like If the hardware serial number matches and the authorization is valid, the program will continue to execute; otherwise, the program will immediately terminate and display the message "Authorization verification failed".
[0044] In the above scheme, only after the signature information verification and authorization verification are passed can the session key be obtained by decrypting with the session private key. This key is then used to further decrypt the core module of the visual displacement program and authorize its operation. Thus, a multi-serial number authorization mechanism and a multi-encryption mechanism are combined to encrypt and authorize the visual displacement program, improving its operational security.
[0045] In a preferred embodiment of the present invention, a visual displacement program encryption authorization method is provided, which further includes: if the camera serial number or USB flash drive serial number is updated, the authorization request file and the authorization file are marked as invalid.
[0046] In one preferred implementation, if the user changes the camera or USB flash drive, the original license will become invalid. A new license request file and license file (license.dat) can be generated by executing steps 101 and 102. Then, license verification can be re-executed via steps 103 and 104.
[0047] In the above scheme, updating the camera serial number or USB flash drive serial number will cause the authorization request file and authorization file to be marked as invalid, enabling authorization management to respond to changes in the actual physical environment, ensuring the flexibility, controllability and security of the multi-serial number authorization mechanism and multi-encryption mechanism, and helping to improve the operational security of the visual displacement program.
[0048] Example 2 See Figure 2 , Figure 2 This is a schematic diagram of the module structure of a visual displacement program encryption authorization system provided in one embodiment of the present invention. Figure 2As shown, this embodiment of the invention also provides a visual displacement program encryption authorization system, including: an authorization request file generation module 201, used to construct a device identifier based on a pre-acquired camera serial number and USB flash drive serial number, and calculate a first device identifier digest value based on a preset encoding algorithm and the device identifier, and generate an authorization request file according to the first device identifier digest value; an encryption module 202, used to generate a public key and a private key based on the authorization request file using a preset key algorithm, and use the public key and private key to sign and encrypt the first device identifier digest value to obtain an authorization code, and save the authorization code to the authorization file; a decryption module 203, used to read the current camera serial number, the current USB flash drive serial number and the current authorization file whenever the visual displacement program starts, calculate a second device identifier digest value using the current camera serial number and the current USB flash drive serial number, and use the public key and private key to decrypt and verify the current authorization file to obtain a decryption verification value; and an authorization module 204, used to authorize the operation of the visual displacement program using the private key if the second device identifier digest value is consistent with the first device identifier digest value based on the decryption verification value.
[0049] This invention proposes a visual displacement program encryption authorization system. It combines the serial numbers of both the camera and the USB flash drive to construct a device identifier, achieving dual physical binding. A preset key algorithm is used to sign and encrypt the device identifier digest to generate an authorization code. Verification logic is embedded in the program startup process, ensuring the authorization file has cryptographically strong unforgeability. Finally, real-time verification during startup checks whether the current hardware information matches the encrypted information in the authorization file, achieving mandatory permission control during program execution. Thus, this system combines multiple serial number authorization mechanisms and multiple encryption mechanisms to encrypt and authorize visual displacement programs, improving their operational security.
[0050] Furthermore, the encryption module 202 includes: a public and private key generation unit 301, used to randomly select an integer within a preset value range as the private key, and calculate the public key corresponding to the private key using a preset key algorithm and the private key; a signature unit 302, used to sign the first device identifier digest value using the private key based on a preset signature algorithm to obtain a signature value; and an authorization code generation unit 303, used to encrypt the signature value and the first device identifier digest value using the public key based on a preset encryption algorithm to obtain an authorization code, and save the authorization code to an authorization file, wherein the authorization file is stored in a USB flash drive.
[0051] Furthermore, the decryption module 203 includes: a device identifier digest value calculation unit 401, used to read the current camera serial number and the current USB flash drive serial number whenever the visual displacement program starts, concatenate the current camera serial number and the current USB flash drive serial number, and calculate a second device identifier digest value using a preset encoding algorithm; a signature value decryption unit 402, used to decrypt the current authorization file using a private key based on a preset decryption algorithm to obtain the signature value and the first device identifier digest value corresponding to the current authorization file; and a signature value verification unit 403, used to verify the signature value using a public key to obtain a decryption verification value.
[0052] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
[0053] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. Furthermore, the described specific features, structures, materials, or characteristics may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of those different embodiments or examples.
[0054] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.
Claims
1. A method for encrypting and authorizing visual displacement programs, characterized in that, include: A device identifier is constructed based on the pre-acquired camera serial number and USB flash drive serial number. A first device identifier digest value is calculated based on a preset encoding algorithm and the device identifier, and an authorization request file is generated based on the first device identifier digest value. Based on the authorization request file, a public key and a private key are generated using a preset key algorithm. The first device identifier digest value is then signed and encrypted using the public key and the private key to obtain an authorization code. The authorization code is then saved to the authorization file. Whenever the visual displacement program starts, it reads the current camera serial number, the current USB flash drive serial number, and the current authorized file, calculates the second device identifier digest value using the current camera serial number and the current USB flash drive serial number, and decrypts and verifies the current authorized file using the public key and the private key to obtain the decryption verification value; Based on the decryption verification value, if the second device identifier digest value is consistent with the first device identifier digest value, then the operation of the visual displacement program is authorized through the private key.
2. The visual displacement program encryption authorization method as described in claim 1, characterized in that, The process of constructing a device identifier based on the pre-acquired camera serial number and USB flash drive serial number, calculating a first device identifier digest value based on a preset encoding algorithm and the device identifier, and generating an authorization request file based on the first device identifier digest value includes: Obtain the camera serial number and USB flash drive serial number; The device identifier is obtained by concatenating the camera serial number and the USB flash drive serial number. The device identifier is hashed using a preset encoding algorithm to obtain a first device identifier digest value; The first device identifier digest value is encapsulated to generate an authorization request file.
3. The visual displacement program encryption authorization method as described in claim 1, characterized in that, Based on the authorization request file, a public key and a private key are generated using a preset key algorithm. The first device identifier digest value is then signed and encrypted using the public key and the private key to obtain an authorization code. The authorization code is then saved to the authorization file, including: Randomly select an integer within a preset value range as the private key, and calculate the public key corresponding to the private key using a preset key algorithm and the private key; Based on a preset signature algorithm, the first device identifier digest value is signed using the private key to obtain a signature value; Based on a preset encryption algorithm, the signature value and the first device identifier digest value are encrypted using the public key to obtain an authorization code, and the authorization code is saved to an authorization file, wherein the authorization file is stored in a USB flash drive.
4. The visual displacement program encryption authorization method as described in claim 3, characterized in that, Whenever the visual displacement program starts, it reads the current camera serial number, the current USB flash drive serial number, and the current authorized file, calculates the second device identifier digest value, and decrypts and verifies the current authorized file using the public key and the private key to obtain a decryption verification value, including: Whenever the visual displacement program is started, the current camera serial number and the current USB flash drive serial number are read, the current camera serial number and the current USB flash drive serial number are concatenated, and the second device identifier digest value is calculated through a preset encoding algorithm; Based on a preset decryption algorithm, the current authorized file is decrypted using the private key to obtain the signature value and the first device identifier digest value corresponding to the current authorized file; The signature value is verified using the public key to obtain the decrypted verification value.
5. The visual displacement program encryption authorization method as described in claim 4, characterized in that, The visual displacement procedure includes: When compiling the visual displacement program, a randomly generated session key is used to encrypt the core module of the visual displacement program, resulting in a ciphertext module file. The steps of executing the authorization request file, generating a public key and a private key using a preset key algorithm, signing and encrypting the first device identifier digest value using the public key and the private key to obtain an authorization code, and saving the authorization code to the authorization file include: generating a session public key and a session private key using a preset key algorithm, encrypting the session key using the session public key based on the preset encryption algorithm to obtain a key authorization code, and saving the key authorization code to the authorization file.
6. The visual displacement program encryption authorization method as described in claim 5, characterized in that, Based on the decryption verification value, if the second device identifier digest value matches the first device identifier digest value, then the execution of the visual displacement program is authorized using the private key, including: If the decryption verification value meets the preset signature verification requirements, then compare the second device identifier digest value with the first device identifier digest value; If the second device identifier digest value is consistent with the first device identifier digest value, the key authorization code is decrypted using the session private key to obtain the session key, and the encrypted module file is decrypted using the session key to obtain the core module of the visual displacement program, so as to authorize the operation of the visual displacement program.
7. A visual displacement program encryption authorization method as described in any one of claims 1 to 6, characterized in that, Also includes: If the camera serial number or the USB flash drive serial number is updated, the authorization request file and the authorization file are marked as invalid.
8. A visual displacement program encryption authorization system, characterized in that, A visual displacement program encryption authorization method applied to any one of claims 1 to 7 includes: The authorization request file generation module is used to construct a device identifier based on the pre-acquired camera serial number and USB flash drive serial number, and calculate a first device identifier digest value based on a preset encoding algorithm and the device identifier, and generate an authorization request file based on the first device identifier digest value; An encryption module is used to generate a public key and a private key based on the authorization request file using a preset key algorithm, and to sign and encrypt the first device identifier digest value using the public key and the private key to obtain an authorization code, and save the authorization code to an authorization file; The decryption module is used to read the current camera serial number, the current USB flash drive serial number, and the current authorized file whenever the visual displacement program is started, calculate the second device identifier digest value using the current camera serial number and the current USB flash drive serial number, and decrypt and verify the current authorized file using the public key and the private key to obtain the decryption verification value; The authorization module is used to authorize the operation of the visual displacement program by means of the private key if the second device identifier digest value is consistent with the first device identifier digest value based on the decryption verification value.
9. A visual displacement program encryption authorization system as described in claim 8, characterized in that, The encryption module includes: The public and private key generation unit is used to randomly select an integer within a preset value range as the private key, and calculate the public key corresponding to the private key using a preset key algorithm and the private key; The signature unit is used to sign the first device identifier digest value using the private key based on a preset signature algorithm to obtain a signature value. The authorization code generation unit is used to encrypt the signature value and the first device identifier digest value using the public key based on a preset encryption algorithm to obtain an authorization code, and save the authorization code to an authorization file, wherein the authorization file is stored in a USB flash drive.
10. A visual displacement program encryption authorization system as described in claim 8, characterized in that, The decryption module includes: The device identifier digest value calculation unit is used to read the current camera serial number and the current USB flash drive serial number whenever the visual displacement program is started, concatenate the current camera serial number and the current USB flash drive serial number, and calculate the second device identifier digest value through a preset encoding algorithm; The signature value decryption unit is used to decrypt the current authorized file using the private key based on a preset decryption algorithm to obtain the signature value and the first device identifier digest value corresponding to the current authorized file; The signature verification unit is used to verify the signature value using the public key to obtain the decrypted verification value.