City security data password encryption method and system
The method and system enhance urban security data protection by combining public key and one-way encryption with data locks, addressing data leakage risks and ensuring accurate data access.
Patent Information
- Application Number
- CN202311557171.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-21
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2043-11-21
AI Technical Summary
Traditional data encryption and protection methods for urban security data are not optimized, leading to potential data leakage risks.
A method and system utilizing a combination of public key encryption and one-way encryption with data locks, involving user-specific key generation, data classification, regular updates, and redundancy cleaning, along with integrity verification and error correction.
Provides double-layer protection against data leakage, ensuring accurate and complete data access while enhancing security and system adaptability.
Smart Images

Figure CN117633829B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of city data security, in particular to a method and system for encrypting city security data passwords. Background Art
[0002] Urban security data refers to a collection of data on various security-related aspects in the city, which is designed to help analyze, evaluate and improve the overall security status of the city. These data can cover a wide range of areas in order to gain a deep understanding of the risks, challenges and opportunities of the city, so as to take appropriate measures to improve the quality of life and sense of security of urban residents. It is vital for modern cities to protect their key data, which is often the key to urban operations. Traditional data encryption and protection methods may not be optimized for the characteristics of complex urban security data, which may expose the data to the risk of leakage. Summary of the invention
[0003] In view of the above-mentioned problems, the present invention is proposed.
[0004] Therefore, the problem to be solved by the present invention is that the traditional data encryption and protection methods may not be optimized for the characteristics of complex urban security data, so that the data may face the risk of leakage.
[0005] To solve the above technical problems, the present invention provides the following technical solutions: a method for encrypting city security data, which includes obtaining city security data and storing it in a city security center database;
[0006] Users log in to the City Security Center to access the city security data in the City Security Center database;
[0007] The city security center generates a user-specific public key to encrypt the accessed city security data and transmits the encrypted data to the user;
[0008] After receiving the encrypted city security data, the user restores the data using a dedicated private key and simultaneously verifies the integrity of the restored data.
[0009] As a preferred solution of the city security data password encryption method described in the present invention, after obtaining the city security data, the data is classified according to the characteristics of the city security data, and the city security data is stored in the city security center database according to the classification characteristics. The city security database regularly updates the city security data and cleans up redundant data in the database.
[0010] As a preferred solution of the city security data password encryption method of the present invention, the user needs to use the user's exclusive account and password to log in to the city security center, and the city security center verifies the account and password entered by the user:
[0011] If the user enters the corresponding account and password successfully, the user is allowed to log in and access the city security data in the database;
[0012] If the user fails to enter the corresponding account and password, the user will be denied access to the City Security Center and the login interface will be jumped to ask the user to re-enter the password;
[0013] If the account entered by the user does not exist, the City Security Center will send the user an account registration page to register a new account.
[0014] As a preferred solution of the city security data password encryption method of the present invention, wherein: after the user logs in to the city security center to query and access the city security data, it is first necessary to generate a public key and a private key that belong to the user through the city security center. The generation algorithm is as follows:
[0015]
[0016] Where p and q are two randomly selected different prime numbers, e is a random integer, and , calculated by the above formula, the user's exclusive public key is , the private key is (n, d).
[0017] As a preferred solution of the city security data encryption method of the present invention, the city security center generates a user-specific public key and private key and then accesses the database to call the city security data selected by the user and encrypt it through the public key:
[0018]
[0019] Where M is the plain text of the city security data, and C is the encrypted city security data. The city security center encrypts the city security data, generates a compressed package for all the data, and adds a one-way encryption data lock to the data compression package:
[0020]
[0021] Where Q is the one-way encrypted data lock password entered by the user, and H is the generated hash value. It is a one-way hash function. After the above steps, the city security center sends the encrypted data to the user.
[0022] As a preferred solution of the city security data password encryption method of the present invention, wherein: after the user receives the city security data compressed package with a one-way encrypted data lock, he enters the one-way encrypted data lock password plain text to decrypt the one-way encrypted data lock to obtain the city security data compressed package:
[0023] If the hash value generated after the user enters the plain text password is consistent with the data lock hash value, the data lock can be unlocked to obtain the city security center data compression package;
[0024] If the hash value generated after the user enters the plain text password is inconsistent with the data lock hash value, the user is allowed to re-enter the plain text password to generate a hash value. If the user enters the plain text password incorrectly ≤ 3 times, the data lock can unlock the data lock and obtain the city security center data compression package. If the user enters the plain text password incorrectly > 3 times, the one-way encrypted data lock will crush the city security center data compression package.
[0025] As a preferred solution of the city security data password encryption method of the present invention, wherein: the user unlocks the one-way encrypted data lock to obtain a city security data compression package, decompresses it to obtain the public key encrypted city security data, and decrypts it using the user's exclusive private key:
[0026]
[0027] Where M is the plain text of the city security data, and C is the encrypted city security data. After the above decryption, the user obtains the original city security data, and the user verifies the data integrity:
[0028] If the original city safety data obtained is complete and correct, the city safety data is interpreted and queried;
[0029] If there are omissions in the original city security data obtained, the city security data is re-decrypted and the missing data is retrieved and supplemented from the database;
[0030] If there are errors in the original city security data obtained, the erroneous part of the data will be marked, the data will be re-acquired from the city security center database, and all encryption and decryption steps will be checked in detail to correct the erroneous part.
[0031] Another object of the present invention is to provide a city security data cryptographic encryption system based on a one-way and public key encryption algorithm, which includes: an acquisition module, a storage module, a transfer module, and a processing module;
[0032] The acquisition module includes a data acquisition submodule and a data cleaning submodule, wherein the data acquisition submodule is used to acquire city safety data, and the data cleaning submodule is used to clean the acquired city safety data;
[0033] The storage module is used to store and protect the city security data acquired by the acquisition module;
[0034] The transfer module is used to transfer the user's operation and transmit the encrypted city safety data to the user;
[0035] The processing module is used to generate a user-specific public key and a private key, and to perform encryption and decryption processing on city security data.
[0036] A computer device comprises: a memory and a processor; the memory stores a computer program, and is characterized in that: when the processor executes the computer program, the steps of a city security data password encryption method are implemented.
[0037] A computer-readable storage medium stores a computer program, characterized in that when the computer program is executed by a processor, the steps of a method for encrypting urban security data are implemented.
[0038] The beneficial effects of the present invention are as follows: the present invention provides double-layer protection for urban security data by combining the multiple encryption mechanisms of public key encryption and one-way encryption data locks, greatly enhancing the protection capability against external attacks, reducing the risk of data leakage, and ensuring that end users can always obtain accurate and complete data information, which has obvious advantages. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0040] Figure 1 This is a flowchart of the city security data password encryption method.
[0041] Figure 2 It is a flowchart of the city security data cryptographic encryption system based on one-way and public key encryption algorithms.
[0042] Figure 3 This is a schematic diagram of the equipment of the city security data cryptographic encryption system based on one-way and public key encryption algorithms. DETAILED DESCRIPTION
[0043] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.
[0044] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0045] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0046] Example 1
[0047] Reference Figure 1 , which is the first embodiment of the present invention, and provides a method for encrypting city security data with a password. The method for encrypting city security data with a password includes the following steps:
[0048] S1. Obtain city security data and store it in the city security center database;
[0049] It should be noted that after obtaining the urban safety data, the data is classified according to the characteristics of the urban safety data, and the urban safety data is stored in the urban safety center database according to the classification characteristics. The urban safety database regularly updates the urban safety data and cleans up redundant data in the database.
[0050] S2. The user logs in to the city security center to access the city security data in the city security center database;
[0051] It should be noted that users need to use their unique account and password to log in to the City Security Center. The City Security Center verifies the account and password entered by the user:
[0052] If the user enters the corresponding account and password successfully, the user is allowed to log in and access the city security data in the database;
[0053] If the user fails to enter the corresponding account and password, the user will be denied access to the City Security Center and the login interface will be jumped to ask the user to re-enter the password;
[0054] If the account entered by the user does not exist, the City Security Center will send the user an account registration page to register a new account.
[0055] S3. The city security center generates a user-specific public key to encrypt the accessed city security data, and transmits the encrypted data to the user;
[0056] It should be noted that after logging into the City Security Center, users need to query and access the city security data. First, they need to generate a public key and a private key that belong to the user through the City Security Center. The generation algorithm is as follows:
[0057]
[0058] Where p and q are two randomly selected different prime numbers, e is a random integer, and, The user's exclusive public key calculated by the above formula is , the private key is (n, d).
[0059] Furthermore, the city security center generates a user-specific public key and private key, accesses the database, calls the city security data selected by the user, and encrypts it with the public key:
[0060]
[0061] Where M is the plain text of the city security data, and C is the encrypted city security data. The city security center encrypts the city security data, generates a compressed package for all the data, and adds a one-way encryption data lock to the data compression package:
[0062]
[0063] Where Q is the one-way encrypted data lock password entered by the user, and H is the generated hash value. It is a one-way hash function. After the above steps, the city security center sends the encrypted data to the user.
[0064] S4. After receiving the encrypted city security data, the user restores the data using the exclusive private key and simultaneously verifies the integrity of the restored data;
[0065] It should be noted that after the user receives the city security data compressed package with the attached one-way encrypted data lock, he / she enters the one-way encrypted data lock password in plain text to decrypt the one-way encrypted data lock to obtain the city security data compressed package:
[0066] If the hash value generated after the user enters the plain text password is consistent with the data lock hash value, the data lock can be unlocked to obtain the city security center data compression package;
[0067] If the hash value generated after the user enters the plain text password is inconsistent with the data lock hash value, the user is allowed to re-enter the plain text password to generate a hash value. If the user enters the plain text password incorrectly ≤ 3 times, the data lock can unlock the data lock and obtain the city security center data compression package. If the user enters the plain text password incorrectly > 3 times, the one-way encrypted data lock will crush the city security center data compression package.
[0068] It should also be noted that after the user unlocks the one-way encrypted data lock, he obtains the compressed package of city security data. After decompression, he obtains the city security data encrypted by the public key and decrypts it with the user's exclusive private key:
[0069]
[0070] Where M is the plain text of the city security data, and C is the encrypted city security data. After the above decryption, the user obtains the original city security data, and the user verifies the data integrity:
[0071] If the original city safety data obtained is complete and correct, the city safety data is interpreted and queried;
[0072] If there are omissions in the original city security data obtained, the city security data is re-decrypted and the missing data is retrieved and supplemented from the database;
[0073] If there are errors in the original city security data obtained, the erroneous part of the data will be marked, the data will be re-acquired from the city security center database, and all encryption and decryption steps will be checked in detail to correct the erroneous part.
[0074] Example 2
[0075] Reference Figure 2 and Figure 3 , which is the second embodiment of the present invention, and provides a city security data cryptographic encryption system based on a one-way and public key encryption algorithm, which includes an acquisition module, a storage module, a transfer module and a processing module;
[0076] The acquisition module includes a data acquisition submodule and a data cleaning submodule, wherein the data acquisition submodule is used to acquire city safety data, and the data cleaning submodule is used to clean the acquired city safety data;
[0077] The storage module is used to store and protect the city security data acquired by the acquisition module;
[0078] The transfer module is used to transfer the user's operation and transmit the encrypted city safety data to the user;
[0079] The processing module is used to generate a user-specific public key and a private key, and to perform encryption and decryption processing on city security data.
[0080] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0081] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0082] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0083] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit with a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit with a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0084] Example 3
[0085] This is the third embodiment of the present invention. This embodiment is different from the previous two embodiments. In order to verify the beneficial effects of the present invention, the present invention and the traditional method are demonstrated through experiments. The experimental results are shown in the following table.
[0086] Table 1: Comparison between the method of the present invention and the traditional method
[0087] Method of the present invention Traditional methods Data security Double protection using public key and one-way encryption Single-mode encryption Data Retention Data classification storage, regular update and redundancy cleaning Centralized storage, possible lack of regular maintenance Data Integrity Perform data integrity check after decryption and correct it in time Reduced or no data integrity checking System security Enhanced continuous error input processing and data lock function Basic error input handling, lack of additional security layer System adaptability The system can be improved to adapt to the ever-advancing technology The system is already solidified and difficult to change
[0088] Table 2: Experimental demonstration of the method of the present invention and the traditional method
[0089] Data accuracy Customer satisfaction Data security Method of the present invention 98.69% 97.46% Strong, hard to crack Traditional methods 94.43% 92.54% Weak, easy to crack
[0090] It can be concluded from the above table that the city security data password encryption method proposed in the present invention has obvious advantages over traditional methods in data processing, security assurance and data accuracy. At the same time, user satisfaction is also better than traditional methods, so it is superior.
[0091] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A city security data password encryption method, characterized in that: include, Obtain city security data and store it in the city security center database; Users log in to the City Security Center to access the city security data in the City Security Center database; The city security center generates a user-specific public key to encrypt the accessed city security data and transmits the encrypted data to the user; After receiving the encrypted city security data, the user restores the data using the exclusive private key and simultaneously verifies the integrity of the restored data; The user needs to use the user's unique account and password to log in to the City Security Center. The City Security Center verifies the account and password entered by the user: If the user enters the corresponding account and password successfully, the user is allowed to log in and access the city security data in the database; If the user fails to enter the corresponding account and password, the user will be denied access to the City Security Center and the login interface will be jumped to ask the user to re-enter the password; If the account entered by the user does not exist, the City Security Center will send the user an account registration page to register a new account; After logging into the city security center, the user queries and accesses the city security data. First, the city security center needs to generate a public key and a private key that belong to the user. The generation algorithm is as follows: n=p×q Where p and q are two randomly selected different prime numbers, e is a random integer, and The above formula calculates that the user's exclusive public key is (n, e) and the private key is (n, d); After obtaining the city safety data, the data is classified according to the characteristics of the city safety data, and the city safety data is stored in the city safety center database according to the classification characteristics. The city safety database regularly updates the city safety data and cleans up redundant data in the database; The city security center generates a public key and a private key exclusive to the user, then accesses the database, calls the city security data selected by the user, and encrypts it with the public key: C=M e mod n Where M is the plain text of the city security data, and C is the encrypted city security data. The city security center encrypts the city security data, generates a compressed package for all the data, and adds a one-way encryption data lock to the data compression package: H=SHA-256(Q) Where Q is the plain text of the one-way encrypted data lock password entered by the user, H is the generated hash value, and SHA-256 is a one-way hash function. After the above steps, the City Security Center sends the encrypted data to the user; After receiving the city security data compressed package with a one-way encrypted data lock, the user enters the one-way encrypted data lock password in plain text to decrypt the one-way encrypted data lock to obtain the city security data compressed package: If the hash value generated after the user enters the plain text password is consistent with the data lock hash value, the data lock can be unlocked to obtain the city security center data compression package; If the hash value generated after the user enters the plain text password is inconsistent with the data lock hash value, the user is allowed to re-enter the plain text password to generate a hash value. If the user enters the plain text password incorrectly ≤ 3 times, the data lock can be unlocked to obtain the compressed data package of the city security center. If the user enters the plain text password incorrectly more than 3 times, the one-way encrypted data lock will shred the compressed data package of the city security center; The user unlocks the one-way encrypted data lock to obtain the city security data compression package, decompresses it to obtain the public key encrypted city security data, and decrypts it with the user's exclusive private key: M=C d mod n Where M is the plain text of the city security data, and C is the encrypted city security data. After the above decryption, the user obtains the original city security data, and the user verifies the data integrity: If the original city safety data obtained is complete and correct, the city safety data is interpreted and queried; If there are omissions in the original city security data obtained, the city security data is re-decrypted and the missing data is retrieved and supplemented from the database; If there are errors in the original city security data obtained, the erroneous part of the data will be marked, the data will be re-acquired from the city security center database, and all encryption and decryption steps will be checked in detail to correct the erroneous part.
2. An encryption system using the city security data password encryption method as claimed in claim 1, characterized in that: It includes an acquisition module, a storage module, a transfer module and a processing module; The acquisition module includes a data acquisition submodule and a data cleaning submodule, wherein the data acquisition submodule is used to acquire city safety data, and the data cleaning submodule is used to clean the acquired city safety data; The storage module is used to store and protect the city security data acquired by the acquisition module; The transfer module is used to transfer the user's operation and transmit the encrypted city safety data to the user; The processing module is used to generate a user-specific public key and a private key, and to perform encryption and decryption processing on city security data.
