Data encryption method and device, electronic equipment and medium
By obtaining target address information to determine the dynamic encryption key and using administrative region code identifiers for data encryption, the problem of personal privacy data leakage is solved, and the security of data information and the randomness and complexity of encryption are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-21
- Publication Date
- 2026-04-07
AI Technical Summary
The protection of personal privacy information is receiving increasing attention, and existing technologies are insufficient to effectively prevent the leakage and cracking of personal privacy data such as mobile phone numbers, ID card numbers, bank card numbers, and address information.
By obtaining the target address information of the data to be encrypted, a dynamic encryption key is determined. The data is then encrypted using this key. The dynamic encryption key includes the code identifier of the administrative region to which the target address information belongs, such as postal code, telephone area code, abbreviation, and license plate area code. A symmetric encryption algorithm is used to encrypt the data, and an asymmetric encryption algorithm can be selected to further protect the key.
It improves the security of data information, solves the risk of data information being cracked due to the leakage of a single key, enhances the randomness and complexity of the key, and improves the security of data encryption.
Smart Images

Figure CN115348061B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information security technology, and in particular to a data encryption method, device, electronic device, and medium. Background Technology
[0002] In the era of the internet and big data, the rapid development of information technology is constantly giving rise to various new business forms and models, and information and data have become important supports for promoting social and technological development. However, the leakage of personal privacy data such as mobile phone numbers, ID card numbers, bank card numbers, and address information can bring great risks and hidden dangers to society and individuals, and the protection of personal privacy information is receiving increasing attention. Summary of the Invention
[0003] To solve the above-mentioned technical problems, or at least partially solve the above-mentioned technical problems, embodiments of the present invention provide a data encryption method, apparatus, electronic device, and medium.
[0004] In a first aspect, embodiments of the present invention provide a data encryption method, comprising: acquiring data to be encrypted; determining target address information based on the data to be encrypted; determining a dynamic encryption key based on the target address information, the dynamic encryption key including a code identifier corresponding to the administrative region to which the target address information belongs; and encrypting the data to be encrypted using the dynamic encryption key to obtain ciphertext corresponding to the data to be encrypted.
[0005] In an optional embodiment, encrypting the data to be encrypted using the dynamic encryption key includes: determining a target sorting rule corresponding to the dynamic encryption key from a plurality of preset optional sorting rules; sorting the dynamic encryption key using the target sorting rule; and encrypting the data to be encrypted using the sorted dynamic encryption key.
[0006] In an optional embodiment, determining the target sorting rule corresponding to the dynamic encryption key from a plurality of preset optional sorting rules includes: calculating the dynamic encryption key according to preset calculation rules to obtain a calculation result; and determining the target sorting rule corresponding to the dynamic encryption key from a plurality of preset optional sorting rules based on the calculation result.
[0007] In an optional embodiment, the step of calculating the dynamic encryption key according to a preset calculation rule to obtain a calculation result includes: determining the number of the plurality of optional sorting rules, using the number as a sorting factor; and using the sorting factor to perform a modulo operation on the dynamic encryption key to obtain a calculation result.
[0008] In an optional embodiment, the dynamic encryption key includes one or more of the following code identifiers corresponding to the administrative region: the postal code of the administrative region, the telephone area code of the administrative region, the abbreviation of the administrative region, and the license plate area code of the administrative region.
[0009] In an optional embodiment, the step of sorting the dynamic encryption key using the target sorting rule and encrypting the data to be encrypted using the sorted dynamic encryption key includes: when the dynamic encryption key includes multiple code identifiers corresponding to the administrative regions, concatenating the multiple code identifiers corresponding to the administrative regions to obtain a first string; sorting the first string using the target sorting rule to obtain a second string; and encrypting the data to be encrypted using the second string.
[0010] In an optional embodiment, the step of calculating the dynamic encryption key according to a preset calculation rule to obtain a calculation result includes: when the dynamic encryption key includes the postal code corresponding to the administrative region, calculating the postal code corresponding to the administrative region according to a preset calculation rule to obtain a calculation result.
[0011] In an optional embodiment, the method further includes: encrypting the dynamic encryption key to obtain key ciphertext; and sending the ciphertext corresponding to the data to be encrypted and the key ciphertext to the receiver.
[0012] In an optional embodiment, the first determining module is further configured to: determine the address data included in the data to be encrypted as target address information when the data to be encrypted includes address data; or, when the data to be encrypted does not include address data, determine the target address information based on a preset mapping rule and a preset address database.
[0013] Secondly, embodiments of the present invention provide a data encryption device, comprising: an acquisition module for acquiring data to be encrypted; a first determination module for determining target address information based on the data to be encrypted; a second determination module for determining a dynamic encryption key based on the target address information, the dynamic encryption key including a code identifier corresponding to the administrative region to which the target address information belongs; and an encryption module for encrypting the data to be encrypted using the dynamic encryption key to obtain ciphertext corresponding to the data to be encrypted.
[0014] In an optional embodiment, the encryption module is further configured to: determine a target sorting rule corresponding to the dynamic encryption key from a plurality of preset optional sorting rules; sort the dynamic encryption key using the target sorting rule; and encrypt the data to be encrypted using the sorted dynamic encryption key.
[0015] In an optional embodiment, the encryption module is further configured to: calculate the dynamic encryption key according to a preset calculation rule to obtain a calculation result; and determine a target sorting rule corresponding to the dynamic encryption key from a plurality of preset optional sorting rules based on the calculation result.
[0016] In an optional embodiment, the encryption module is further configured to: determine the number of the plurality of optional sorting rules, use the number as a sorting factor; and use the sorting factor to perform a modulo operation on the dynamic encryption key to obtain a calculation result.
[0017] In an optional embodiment, the encryption module is further configured to: concatenate the multiple code identifiers corresponding to the administrative regions to obtain a first string when the dynamic encryption key includes multiple code identifiers corresponding to the administrative regions; sort the first string using the target sorting rule to obtain a second string; and encrypt the data to be encrypted using the second string.
[0018] In an optional embodiment, the encryption module is further configured to: when the dynamic encryption key includes the postal code corresponding to the administrative region, calculate the postal code corresponding to the administrative region according to a preset calculation rule to obtain a calculation result.
[0019] In an optional embodiment, the device further includes a sending module, configured to: encrypt the dynamic encryption key to obtain key ciphertext; and send the ciphertext corresponding to the data to be encrypted and the key ciphertext to the receiver.
[0020] In an optional embodiment, determining the target address information based on the data to be encrypted includes: if the data to be encrypted includes address data, determining the address data included in the data to be encrypted as the target address information; or, if the data to be encrypted does not include address data, determining the target address information based on a preset mapping rule and a preset address database.
[0021] Thirdly, embodiments of the present invention provide an electronic device, including: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the data encryption method as described in the first aspect.
[0022] Fourthly, embodiments of the present invention provide a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the data encryption method as described in the first aspect.
[0023] One embodiment of the above invention has the following advantages or beneficial effects:
[0024] This invention determines a dynamic encryption key based on the target address information corresponding to the data to be encrypted. This dynamic encryption key includes a code identifier corresponding to the administrative region to which the target address information belongs. Different target address information corresponds to different administrative regions, and different administrative regions have different code identifiers. Therefore, different target address information corresponds to different dynamic encryption keys, and different data to be encrypted corresponds to different dynamic encryption keys. Using this dynamic encryption key to encrypt the data to be encrypted yields the corresponding ciphertext. This solves the risk of data information being cracked due to the leakage of a single key, improving data security. Furthermore, using the code identifier of the administrative region to which the target address information belongs as the dynamic encryption key increases the randomness and complexity of the key, further enhancing the security of both the key and the ciphertext.
[0025] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description
[0026] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:
[0027] Figure 1 A flowchart illustrating a data encryption method according to an embodiment of the present invention is shown schematically.
[0028] Figure 2 A flowchart illustrating another embodiment of the data encryption method of the present invention is shown schematically;
[0029] Figure 3 A flowchart illustrating another embodiment of the data encryption method of the present invention is shown schematically;
[0030] Figure 4 This diagram illustrates the structure of a data encryption device according to an embodiment of the present invention.
[0031] Figure 5 The schematic diagram illustrates the structure of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0032] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0033] Figure 1 A flowchart illustrating a data encryption method according to an embodiment of the present invention is shown. Figure 1 As shown, the method includes:
[0034] Step 101: Obtain the data to be encrypted.
[0035] The data to be encrypted can be any type of data information. This data can be address data, may include address data and other data, or may not include address data.
[0036] Step 102: Determine the target address information based on the data to be encrypted.
[0037] In this step, if the data to be encrypted includes address data (e.g., the data to be encrypted is address data, or the data to be encrypted includes address data and other data), the address data included in the data to be encrypted is determined as the target address information. Alternatively, if the data to be encrypted does not include address data, the target address information is determined based on a preset mapping rule and a preset address database. The preset address database can pre-store multiple address information entries to filter out the target address information corresponding to the data to be encrypted. The preset mapping rule can be a random selection rule; that is, when the data to be encrypted does not include address data, an address can be randomly selected from the preset address database as the target address information. Alternatively, the preset mapping rule can be to first calculate the hash value of the data to be encrypted and then map that hash value to the address database to determine the target address information corresponding to the data to be encrypted.
[0038] The target address information can be a relatively coarse address, such as xx province xx city, or a more detailed address, such as xx province xx city xx county xx village xx street xx number. This invention does not impose any limitations on this.
[0039] Step 102: Determine a dynamic encryption key based on the target address information. The dynamic encryption key includes a code identifier corresponding to the administrative region to which the target address information belongs.
[0040] In this embodiment, the code identifier corresponding to the administrative region is used to uniquely identify the administrative region, and different administrative regions have different corresponding code identifiers, so that different target address information corresponds to different dynamic encryption keys, and different data to be encrypted corresponds to different dynamic encryption keys. The leakage of a certain dynamic encryption key will not affect other dynamic encryption keys, thus solving the risk of data information being cracked due to the leakage of a single key and improving the security of data information.
[0041] In an optional embodiment, the dynamic encryption key includes one or more of the following code identifiers corresponding to the administrative region: the postal code corresponding to the administrative region, the telephone area code corresponding to the administrative region, the abbreviation corresponding to the administrative region, and the license plate area code corresponding to the administrative region.
[0042] Among them, an administrative region (which can also be called an administrative division) is a region divided hierarchically for the convenience of administrative management. As an example, an administrative region may include provincial administrative regions, prefecture-level administrative regions, county-level administrative regions, and township-level administrative regions. For provincial administrative regions, each provincial administrative region has a corresponding abbreviation. For example, the abbreviation of Beijing is Jing, the abbreviation of Shanghai is Hu, the abbreviation of Hebei Province is Ji, and the abbreviation of Shanxi Province is Jin. The above abbreviations of administrative regions are the abbreviations of provincial administrative regions.
[0043] A postal code (also known as a postal district code) is a coding method used by a country or region to automate mail sorting and digitalize the postal network in order to speed up the delivery of mail. The postal code adopts a four-level six-digit coding structure. The first two digits represent the province (municipality directly under the Central Government, autonomous region); the third digit represents the postal area; the fourth digit represents the county (city); the last two digits represent the delivery office (post office).
[0044] A telephone area code (which can also be called a telephone division number, abbreviated as area code) refers to the commonly used telephone division numbers of the administrative regions of major cities in the world. For example, the international area code of China is 86, the area code of Beijing is 10, the area code of Shanghai is 21, etc.
[0045] A license plate is the numbering and information registration for each vehicle. Its main function is that through the license plate, one can know the region to which the vehicle belongs, and also find out the owner of the vehicle and the registration information of the vehicle according to the license plate. The first character of the license plate is a Chinese character: it represents the provincial administrative region where the vehicle's household is located, which is the abbreviation of each provincial administrative region (province, municipality directly under the Central Government, autonomous region). For example, for Beijing, it is "Jing", and for Shanghai, it is "Hu". The second character of the license plate is an English letter: it represents the prefecture-level administrative region where the vehicle's household is located. Generally, it is the letter code of each prefecture-level city, region, autonomous prefecture, or league. Generally, it is ranked according to the situation of each prefecture-level administrative region by the provincial vehicle management office (the letter "A" is the code for the capital, the seat of the provincial government, or the central urban area of a municipality directly under the Central Government, and the subsequent letters are ranked without priority). For example, in Zhejiang Province, "A" is the code for Hangzhou, "B" is the code for Ningbo, and "C" is the code for Wenzhou. The license plate area code corresponding to the above administrative region can be the second English letter of the license plate.
[0046] As an example, as shown in Table 1 below, the target address information is xx Community, Zhichun Road, Haidian District, Beijing Municipality. The postal code of the administrative region to which this target address information belongs is 100088, the telephone area code is 10, the abbreviation is "Jing", and the license plate area code is "A". The target address information is Xiyuan Lane, Huangmei County, Huanggang City, Hubei Province. The postal code of the administrative region to which it belongs is 435500, the telephone area code is 0713, the abbreviation is "E", and the license plate area code is "J". The target address information is Tuzhuang Residents' Committee, Boli Town, Chuzhou District, Huai'an City, Jiangsu Province. The postal code of the administrative region to which it belongs is 223223, the telephone area code is 0517, the abbreviation is "Su", and the license plate area code is "H".
[0047] Table 1:
[0048]
[0049] In an optional embodiment, a code identification database can be pre-constructed to record the postal codes corresponding to different regions across the country, the abbreviations corresponding to national provincial-level administrative regions, the telephone area codes corresponding to national provincial-level administrative regions, and the license plate area codes corresponding to each province and city in the country. After obtaining the target address information corresponding to the data to be encrypted, the target address information is matched with the information in the code identification database, so as to determine the dynamic encryption key corresponding to the target address information.
[0050] In the embodiment of the present invention, using the code identification of the administrative region to which the target address information belongs as the dynamic encryption key can improve the randomness and complexity of the key, thereby improving the security of the key and the ciphertext.
[0051] Step 103: Use the dynamic encryption key to encrypt the data to be encrypted, and obtain the ciphertext corresponding to the data to be encrypted.
[0052] In this embodiment, a symmetric encryption algorithm can be used to encrypt the data to be encrypted. A symmetric encryption algorithm is an algorithm that uses the same key for encryption and decryption. As an example, symmetric encryption algorithms may include, but are not limited to, AES (Advanced Encryption Standard) and DES (Data Encryption Standard).
[0053] This invention determines a dynamic encryption key based on the target address information corresponding to the data to be encrypted. This dynamic encryption key includes a code identifier corresponding to the administrative region to which the target address information belongs. Different target address information corresponds to different administrative regions, and different administrative regions have different code identifiers. Therefore, different target address information corresponds to different dynamic encryption keys, and different data to be encrypted corresponds to different dynamic encryption keys. Using this dynamic encryption key to encrypt the data to be encrypted yields the corresponding ciphertext. This solves the risk of data information being cracked due to the leakage of a single key, improving data security. Furthermore, using the code identifier of the administrative region to which the target address information belongs as the dynamic encryption key increases the randomness and complexity of the key, further enhancing the security of both the key and the ciphertext.
[0054] In an optional embodiment, the data encryption method further includes: encrypting the dynamic encryption key to obtain key ciphertext; and sending the ciphertext corresponding to the data to be encrypted and the key ciphertext to the receiver.
[0055] In this invention, the data encryption method encrypts the data to be encrypted by encrypting a dynamic encryption key after the data to be encrypted is in practice. This ensures security during the transmission of the dynamic encryption key. The encrypted dynamic encryption key and the ciphertext corresponding to the data to be encrypted are then compressed into a data packet and transmitted to the receiver. Upon receiving the data packet, the receiver first decrypts the dynamic encryption key and then uses the same key to decrypt the ciphertext to obtain the data. For example, an asymmetric encryption algorithm such as RSA can be used to encrypt the dynamic encryption key, or a symmetric encryption algorithm such as AES can be used.
[0056] Figure 2 A flowchart illustrating another embodiment of the data encryption method of the present invention is shown, such as... Figure 2 As shown, the method includes:
[0057] Step 201: Obtain the data to be encrypted;
[0058] Step 202: Determine the target address information based on the data to be encrypted;
[0059] Step 203: Determine a dynamic encryption key based on the target address information, wherein the dynamic encryption key includes a code identifier corresponding to the administrative region to which the target address information belongs;
[0060] Step 204: Determine the target sorting rule corresponding to the dynamic encryption key from a plurality of preset optional sorting rules;
[0061] Step 205: Sort the dynamic encryption key using the target sorting rule;
[0062] Step 206: Encrypt the data to be encrypted using the sorted dynamic encryption key to obtain the ciphertext corresponding to the data to be encrypted.
[0063] Steps 201-203 can be referenced. Figure 1 The embodiments shown will not be described in detail here.
[0064] For step 204, the sorting rules in this embodiment are used to sort the dynamic encryption key to improve its randomness, complexity, and security, thereby further enhancing the security of the data to be encrypted. As an example, the preset optional sorting rules include, but are not limited to, one or more of the following: dictionary sorting, key index counting, least significant digit priority sorting, most significant digit priority sorting, and three-way quicksort.
[0065] When determining the target sorting rule corresponding to the dynamic encryption key, one sorting rule can be randomly selected from a number of preset optional sorting rules, or it can be selected according to the preset rules.
[0066] As a specific example, the target sorting rule corresponding to the encryption parameters can be determined from a plurality of preset optional sorting rules according to the following process:
[0067] The dynamic encryption key is calculated according to the preset calculation rules to obtain the calculation result;
[0068] Based on the calculation results, the target sorting rule corresponding to the encryption parameter is determined from a plurality of preset optional sorting rules.
[0069] Among them, the preset operation rule can be the modulo operation, which can be used to perform the modulo operation on the dynamic encryption key to obtain the calculation result. Based on the calculation result, the target sorting rule is determined from multiple preset optional sorting rules.
[0070] Furthermore, when performing a remainder calculation on the dynamic encryption key, the number of multiple optional sorting rules can be used as a sorting factor. This sorting factor is then used to perform a remainder calculation on the dynamic encryption key to obtain the calculation result.
[0071] As a specific example, suppose the preset optional sorting rules include: (0) dictionary sorting, (1) key index counting, (2) least significant digit priority sorting, (3) most significant digit priority sorting, and (4) three-way quick sorting. The number of optional sorting rules is 5, and the sorting factor is 5. The dynamic encryption key includes the postal code corresponding to the administrative region to which the target address information belongs. Suppose the postal code is 100088, then 100088%5 = 3, and the target sorting rule corresponding to the dynamic encryption key is the most significant digit priority sorting. In an optional embodiment, there is a case where the postal code starts with 0. In this case, the calculation can start from a non-zero number. For example, if the postal code is 00501, the calculation can start from 5, 501%5 = 1, and the corresponding target sorting rule is the key index counting method.
[0072] In an optional embodiment, as described above, the dynamic encryption key may include one or more code identifiers corresponding to administrative regions. When calculating the dynamic encryption key according to preset calculation rules, one or more code identifiers within the dynamic encryption key can be calculated. For example, assuming the dynamic encryption key includes the postal code and abbreviation of the administrative region to which the target address information belongs, the postal code or abbreviation can be calculated separately according to preset calculation rules, or the string concatenated with the postal code and abbreviation can be calculated according to preset calculation rules.
[0073] For steps 205-206, if the dynamic encryption key includes a code identifier for an administrative region, the dynamic encryption key can be directly sorted using the target sorting rule. If the dynamic encryption key includes code identifiers corresponding to multiple administrative regions, the string obtained by concatenating the code identifiers corresponding to multiple administrative regions can be sorted using the target sorting rule.
[0074] Specifically, when the dynamic encryption key includes multiple code identifiers corresponding to the administrative regions, the process of sorting the dynamic encryption key and encrypting the data to be encrypted using the sorted dynamic encryption key includes: concatenating the code identifiers corresponding to the multiple administrative regions to obtain a first string; sorting the first string using a target sorting rule to obtain a second string; and encrypting the data to be encrypted using the second string.
[0075] The data encryption method of this invention determines a dynamic encryption key based on the target address information corresponding to the data to be encrypted. This dynamic encryption key includes a code identifier corresponding to the administrative region to which the target address information belongs. Different target address information corresponds to different administrative regions, and different administrative regions have different code identifiers. Therefore, different target address information corresponds to different dynamic encryption keys, and different data to be encrypted corresponds to different dynamic encryption keys. This solves the risk of data information being cracked due to the leakage of a single key, improving the security of the data information. Furthermore, after obtaining the dynamic encryption key, a target sorting rule corresponding to the dynamic encryption key is determined from a preset selectable sorting rule. The dynamic encryption key is then sorted using this target sorting rule, further enhancing the randomness, complexity, and security of the dynamic encryption key. The sorted dynamic encryption key is then used to encrypt the address information to be encrypted, further improving the security of the data information.
[0076] Figure 3 The flowchart illustrating another embodiment of the data encryption method of the present invention is shown. In this embodiment, the data to be encrypted is address information, and so on... Figure 3 As shown, the method includes:
[0077] Step 301: Obtain the address information to be encrypted;
[0078] Step 302: Based on the address information to be encrypted, query the preset database to determine the code identifier corresponding to the administrative region to which the address information to be encrypted belongs: the postal code of the administrative region, the telephone area code of the administrative region, the abbreviation of the administrative region, and the license plate area code of the administrative region;
[0079] Step 303: Concatenate the postal code, telephone area code, abbreviation, and license plate area code corresponding to the administrative region to which the address information to be encrypted belongs to obtain the first string; this first string is the dynamic encryption key;
[0080] Step 304: Perform a modulo operation on the postal code corresponding to the administrative region to which the address information to be encrypted belongs, and obtain the calculation result; based on the calculation result, determine the target sorting rule corresponding to the dynamic encryption key from a number of preset optional sorting rules;
[0081] Step 305: Sort the first string using the target sorting rule to obtain the second string; this second string is the sorted dynamic encryption key;
[0082] Step 306: Use the sorted dynamic encryption key (i.e., the second string) to encrypt the address information to be encrypted, and obtain the ciphertext corresponding to the address information to be encrypted;
[0083] Step 307: Encrypt the sorted dynamic encryption key (i.e., the second string) to obtain the key ciphertext;
[0084] Step 308: Send the ciphertext and key ciphertext corresponding to the address information to be encrypted to the recipient.
[0085] The data encryption method of this invention obtains parameters such as postal code, abbreviation, telephone area code, and license plate area code of the corresponding administrative region through the address information to be encrypted. Based on the postal code, a specified sorting rule is selected, and a dynamic encryption key is generated using the above-mentioned parameters such as postal code, abbreviation, telephone area code, and license plate area code of the administrative region and the specified sorting rule. This maximizes the randomness, security, and complexity of the key, solves the risk of data information being cracked due to the leakage of a single key, and improves the security of data information.
[0086] Figure 4 A schematic diagram of the structure of a data encryption device 400 according to an embodiment of the present invention is shown, as follows: Figure 4 As shown, the data encryption device 400 includes:
[0087] Module 401 is used to acquire the data to be encrypted;
[0088] The first determining module 402 is used to determine the target address information based on the data to be encrypted;
[0089] The second determining module 403 is used to determine a dynamic encryption key based on the target address information, wherein the dynamic encryption key includes a code identifier corresponding to the administrative region to which the target address information belongs;
[0090] The encryption module 404 is used to encrypt the data to be encrypted using the dynamic encryption key to obtain the ciphertext corresponding to the data to be encrypted.
[0091] The data encryption device of this invention determines a dynamic encryption key based on the target address information corresponding to the data to be encrypted. The dynamic encryption key includes a code identifier corresponding to the administrative region to which the target address information belongs. Different target address information corresponds to different administrative regions, and different administrative regions have different code identifiers. Therefore, different target address information corresponds to different dynamic encryption keys, and different data to be encrypted corresponds to different dynamic encryption keys. The data to be encrypted is encrypted using this dynamic encryption key to obtain the ciphertext corresponding to the data to be encrypted. This can solve the risk of data information being cracked due to the leakage of a single key, and improve the security of data information. At the same time, using the code identifier of the administrative region to which the target address information belongs as the dynamic encryption key can improve the randomness and complexity of the key, further improving the security of the key and the ciphertext.
[0092] In an optional embodiment, the encryption module is further configured to: determine a target sorting rule corresponding to the encryption parameter from a plurality of preset optional sorting rules; sort the encryption parameter using the target sorting rule; and use the sorted encryption parameter as an encryption key.
[0093] In an optional embodiment, the encryption module is further configured to: determine a target sorting rule corresponding to the dynamic encryption key from a plurality of preset optional sorting rules; sort the dynamic encryption key using the target sorting rule; and encrypt the data to be encrypted using the sorted dynamic encryption key.
[0094] In an optional embodiment, the encryption module is further configured to: calculate the dynamic encryption key according to a preset calculation rule to obtain a calculation result; and determine a target sorting rule corresponding to the dynamic encryption key from a plurality of preset optional sorting rules based on the calculation result.
[0095] In an optional embodiment, the encryption module is further configured to: determine the number of the plurality of optional sorting rules, use the number as a sorting factor; and use the sorting factor to perform a modulo operation on the dynamic encryption key to obtain a calculation result.
[0096] In an optional embodiment, the encryption module is further configured to: concatenate the multiple code identifiers corresponding to the administrative regions to obtain a first string when the dynamic encryption key includes multiple code identifiers corresponding to the administrative regions; sort the first string using the target sorting rule to obtain a second string; and encrypt the data to be encrypted using the second string.
[0097] In an optional embodiment, the encryption module is further configured to: when the dynamic encryption key includes the postal code corresponding to the administrative region, calculate the postal code corresponding to the administrative region according to a preset calculation rule to obtain a calculation result.
[0098] In an optional embodiment, the device further includes a sending module, configured to: encrypt the dynamic encryption key to obtain key ciphertext; and send the ciphertext corresponding to the data to be encrypted and the key ciphertext to the receiver.
[0099] In an optional embodiment, the first determining module is further configured to: determine the address data included in the data to be encrypted as target address information when the data to be encrypted includes address data; or, when the data to be encrypted does not include address data, determine the target address information based on a preset mapping rule and a preset address database.
[0100] The above-described apparatus can execute the method provided in the embodiments of the present invention, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be found in the method provided in the embodiments of the present invention.
[0101] This invention also provides an electronic device, such as... Figure 5 As shown, it includes a processor 501, a communication interface 502, a memory 503, and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 504.
[0102] Memory 503 is used to store computer programs;
[0103] When the processor 501 executes the program stored in the memory 503, it performs the following steps: acquiring data to be encrypted; determining target address information based on the data to be encrypted; determining a dynamic encryption key based on the target address information, wherein the dynamic encryption key includes a code identifier corresponding to the administrative region to which the target address information belongs; and encrypting the data to be encrypted using the dynamic encryption key to obtain ciphertext corresponding to the data to be encrypted.
[0104] The communication bus 504 mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus 504 can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, it is represented by only one thick line in the figure, but this does not indicate that there is only one bus or one type of bus.
[0105] Communication interface 502 is used for communication between the aforementioned terminal and other devices.
[0106] The memory 503 may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor 501.
[0107] The processor 501 mentioned above can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0108] In another embodiment of the present invention, a computer-readable medium is also provided, which stores instructions that, when executed on a computer, cause the computer to perform any of the data encryption methods described in the above embodiments.
[0109] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the data encryption methods described in the above embodiments.
[0110] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0111] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0112] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0113] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.
Claims
1. A data encryption method, characterized in that, include: Retrieve the data to be encrypted; If the data to be encrypted includes address data, the address data included in the data to be encrypted is determined as the target address information; or if the data to be encrypted does not include address data, the target address information is determined based on a preset mapping rule and a preset address database. Based on the target address information, a dynamic encryption key is determined, wherein the dynamic encryption key includes a code identifier corresponding to the administrative region to which the target address information belongs; The number of preset optional sorting rules is determined, and the number is used as a sorting factor; the optional sorting rules include one or more of the following: dictionary sorting, key index counting method, least-order priority sorting method, most-order priority sorting method, and three-way quicksort. The dynamic encryption key is moduloed using the sorting factor to obtain the calculation result; Based on the calculation results, a target sorting rule corresponding to the dynamic encryption key is determined from the plurality of optional sorting rules; The dynamic encryption key is sorted using the target sorting rule, and the sorted dynamic encryption key is used to encrypt the data to be encrypted to obtain the ciphertext corresponding to the data to be encrypted.
2. The method according to claim 1, characterized in that, The dynamic encryption key includes one or more of the following code identifiers corresponding to the administrative region: the postal code of the administrative region, the telephone area code of the administrative region, the abbreviation of the administrative region, and the license plate area code of the administrative region.
3. The method according to claim 2, characterized in that, The step of sorting the dynamic encryption key using the target sorting rule, and then encrypting the data to be encrypted using the sorted dynamic encryption key, includes: When the dynamic encryption key includes code identifiers corresponding to multiple administrative regions, the code identifiers corresponding to multiple administrative regions are concatenated to obtain a first string; The first string is sorted using the target sorting rule to obtain the second string; The data to be encrypted is encrypted using the second string.
4. The method according to claim 2, characterized in that, The step of using the sorting factor to perform a modulo operation on the dynamic encryption key to obtain the calculation result includes: If the dynamic encryption key includes the postal code corresponding to the administrative region, the postal code corresponding to the administrative region is used for modulo operation to obtain the calculation result.
5. The method according to claim 1, characterized in that, The method further includes: The dynamic encryption key is encrypted to obtain the key ciphertext; The ciphertext corresponding to the data to be encrypted and the key ciphertext are sent to the recipient.
6. A data encryption device, characterized in that, include: The acquisition module is used to acquire the data to be encrypted. The first determining module is used to determine the address data included in the data to be encrypted as target address information when the data to be encrypted includes address data; or to determine the target address information based on a preset mapping rule and a preset address database when the data to be encrypted does not include address data. The second determining module is used to determine a dynamic encryption key based on the target address information, wherein the dynamic encryption key includes a code identifier corresponding to the administrative region to which the target address information belongs; An encryption module is used to determine the number of preset optional sorting rules, using the number as a sorting factor; the optional sorting rules include one or more of the following: dictionary sorting, key index counting, low-order priority sorting, high-order priority sorting, and three-way quicksort; using the sorting factor, a modulo operation is performed on the dynamic encryption key to obtain a calculation result; based on the calculation result, a target sorting rule corresponding to the dynamic encryption key is determined from the multiple optional sorting rules; the dynamic encryption key is sorted using the target sorting rule; and the sorted dynamic encryption key is used to encrypt the data to be encrypted to obtain the ciphertext corresponding to the data to be encrypted.
7. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-5.
8. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-5.
Citation Information
Patent Citations
Cargo antitheft method and device based on Internet of vehicles
CN106657211A
Cryptographic key
US20150379286A1