Data encryption method, device and storage medium based on classification identification

By using pre-trained sensitive data identification models and randomly generated secret keys to encrypt text, the problem of inconvenient encryption and difficulty in data privacy protection in the existing technology is solved, automatic identification and encryption of sensitive data is realized, and data is ensured. Security.

CN117556447BActive Publication Date: 2024-10-11GOLDEN NETWORK (BEIJING) E-COMMERCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311612430.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-29
Publication Date
2024-10-11
Estimated Expiration
2043-11-29

AI Technical Summary

Technical Problem

Encryption of sensitive data in text in the prior art requires pre-setting encryption fields, which makes the encryption process inconvenient and makes it difficult to automatically identify and protect data privacy.

Method used

Using a data encryption method based on classification recognition, the sensitive data in the text to be encrypted is identified through a pre-trained sensitive data recognition model, and a randomly generated secret key pair is used for encryption, and the identification of the secret key pair is recorded in the text information table. Information is encrypted with preconfigured encryption algorithms.

Benefits of technology

It realizes automatic identification and encryption of sensitive data in text, greatly facilitates user operations, effectively protects data privacy, and facilitates the encryption end to decrypt and restore encrypted data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117556447B_ABST
    Figure CN117556447B_ABST
Patent Text Reader

Abstract

The present invention discloses a data encryption method, device and storage medium based on classification identification, and relates to the field of data encryption technology. The data encryption method based on classification identification includes: obtaining a text to be encrypted; identifying sensitive data in the text to be encrypted through a pre-trained sensitive data identification model, and writing the position of the sensitive data in the text to be encrypted into a text information table corresponding to the text to be encrypted; encrypting the sensitive data in the text to be encrypted through a public key in a randomly generated key pair to obtain the encrypted text, and writing the identifier corresponding to the key pair into the text information table; encrypting the information in the text information table through a pre-configured encryption algorithm. The data encryption method, device and storage medium based on classification identification disclosed by the present invention can realize automatic identification and encryption of sensitive data, which greatly facilitates users to encrypt sensitive data in text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of data encryption, and in particular relates to a data encryption method, device and storage medium based on classification identification. Background Art

[0002] Data encryption refers to the conversion of plain text into cipher text through encryption algorithms and encryption keys. Data encryption is the most reliable way for computer systems to protect information. It uses cryptographic technology to encrypt information and achieve information hiding, thereby protecting the security of information.

[0003] In the process of data encryption, sensitive data in the text is often encrypted for the purpose of privacy protection. In the prior art, the encryption of sensitive data in the text is mostly done by pre-setting the fields to be encrypted, and only encrypting the set fields during encryption. However, such a method requires pre-setting the fields to be encrypted each time encryption is performed, which brings great inconvenience to the encryption of sensitive data in the text.

[0004] Therefore, how to provide an effective solution to facilitate encryption of sensitive data in text has become a problem to be solved urgently in the prior art. Summary of the invention

[0005] The purpose of the present invention is to provide a data encryption method, device and storage medium based on classification identification to solve the above-mentioned problems existing in the prior art.

[0006] In order to achieve the above object, the present invention adopts the following technical solutions:

[0007] In a first aspect, the present invention provides a data encryption method based on classification identification, comprising:

[0008] Get the text to be encrypted;

[0009] Identify the sensitive data in the text to be encrypted by using a pre-trained sensitive data identification model, and write the position of the sensitive data in the text to be encrypted into a text information table corresponding to the text to be encrypted;

[0010] Encrypt the sensitive data in the text to be encrypted by using the public key in the randomly generated key pair to obtain the encrypted text, and write the identifier corresponding to the key pair into the text information table;

[0011] The information in the text information table is encrypted using a preconfigured encryption algorithm.

[0012] Based on the above disclosed content, the present invention obtains the text to be encrypted; identifies the sensitive data in the text to be encrypted by a pre-trained sensitive data recognition model, and writes the position of the sensitive data in the text to be encrypted into the text information table corresponding to the text to be encrypted; encrypts the sensitive data in the text to be encrypted by the public key in the randomly generated key pair to obtain the encrypted text, and writes the identifier corresponding to the key pair into the text information table; encrypts the text information by a pre-configured encryption algorithm. In this way, the sensitive data to be encrypted in the text can be easily and accurately identified, and the sensitive data in the text can be encrypted, thereby realizing automatic identification and encryption of sensitive data, which greatly facilitates the encryption of sensitive data in the text by the user. At the same time, encryption is performed by a randomly generated key pair during encryption, so that the user's data privacy can be effectively protected. In addition, the identifier corresponding to the key pair is written into the text information table and the information in the text information table is encrypted by a pre-configured encryption algorithm, so that after the encryption end restores the encrypted information, the corresponding decryption key is found according to the identifier corresponding to the key pair recorded in the text information table, thereby decrypting and restoring the encrypted sensitive data.

[0013] Through the above-mentioned design, the present invention can very conveniently and accurately identify sensitive data that needs to be encrypted in the text, and encrypt the sensitive data in the text, thereby realizing automatic identification and encryption of sensitive data, which greatly facilitates users to encrypt sensitive data in the text, can effectively protect users' data privacy, and facilitates the encryption end to decrypt and restore the encrypted sensitive data, which is convenient for practical application and promotion.

[0014] In one possible design, before identifying the sensitive data in the to-be-encrypted text by using a pre-trained sensitive data identification model, the method further includes:

[0015] Obtaining a training sample set, wherein the training sample set includes a plurality of sample texts with labeled sensitive data;

[0016] The sample text in the training sample set is used as the input of the neural network model, and the sensitive data marked in the sample text is used as the output for training to obtain the sensitive data recognition model.

[0017] In one possible design, encrypting the sensitive data in the to-be-encrypted text by using the public key in the randomly generated key pair includes:

[0018] Selecting an unused first key pair from a pre-randomly generated key pair list;

[0019] The sensitive data in the text to be encrypted is encrypted using the public key in the first key pair.

[0020] In one possible design, encrypting the sensitive data in the to-be-encrypted text by using the public key in the randomly generated key pair includes:

[0021] Randomly generate a second key pair;

[0022] The sensitive data in the text to be encrypted is encrypted using the public key in the second key pair.

[0023] In a possible design, the sensitive data in the text to be encrypted is encrypted by using the public key in the randomly generated key pair to obtain the encrypted text, and the identifier corresponding to the key pair is written into the text information table, including:

[0024] The sensitive data in the text to be encrypted is encrypted by using the public key in the randomly generated third key pair, and the remaining data in the text to be encrypted except the sensitive data is encrypted by using the public key in the randomly generated fourth key pair to obtain the encrypted text, and the identifier corresponding to the third key pair and the identifier corresponding to the fourth key pair are written into the text information table.

[0025] In one possible design, the sensitive data identification model is a bidirectional long short-term memory network model or a conditional random field model.

[0026] In one possible design, after encrypting the information in the text information table using a preconfigured encryption algorithm, the method further includes:

[0027] The encrypted information is associated with the text to be encrypted.

[0028] In a second aspect, the present invention provides a data encryption device based on classification identification, comprising:

[0029] An acquisition unit, used for acquiring the text to be encrypted;

[0030] An identification unit, used to identify sensitive data in the text to be encrypted by using a pre-trained sensitive data identification model;

[0031] A writing unit, used for writing the sensitive data at a position in the text to be encrypted into a text information table corresponding to the text to be encrypted;

[0032] An encryption unit, used to encrypt the sensitive data in the text to be encrypted by using a public key in a randomly generated key pair to obtain an encrypted text;

[0033] The writing unit is further used to write the identifier corresponding to the key pair into the text information table;

[0034] The encryption unit is further used to encrypt the information in the text information table using a preconfigured encryption algorithm.

[0035] In a third aspect, the present invention provides another data encryption device based on classification identification, comprising a memory, a processor and a transceiver that are communicatively connected in sequence, wherein the memory is used to store computer programs, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the data encryption method based on classification identification as described in the first aspect or any possible design of the first aspect.

[0036] In a fourth aspect, the present invention provides a computer-readable storage medium having instructions stored thereon, which, when executed on a computer, executes the data encryption method based on classification identification as described in the first aspect or any possible design of the first aspect.

[0037] In a fifth aspect, the present invention provides a computer program product comprising instructions, which, when executed on a computer, causes the computer to execute the data encryption method based on classification identification as described in the first aspect or any possible design of the first aspect.

[0038] Beneficial effects:

[0039] The data encryption method, device and storage medium based on classification identification provided by the present invention can very conveniently and accurately identify sensitive data that needs to be encrypted in a text, and encrypt the sensitive data in the text, thereby realizing automatic identification and encryption of sensitive data, greatly facilitating users to encrypt sensitive data in the text, and can effectively protect users' data privacy, and facilitate the encryption end to decrypt and restore the encrypted sensitive data, which is convenient for practical application and promotion. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 A flow chart of a data encryption method based on classification identification provided in an embodiment of the present application;

[0041] Figure 2 A schematic diagram of the structure of a data encryption device based on classification identification provided in an embodiment of the present application;

[0042] Figure 3 A schematic diagram of the structure of another data encryption device based on classification identification provided in an embodiment of the present application. DETAILED DESCRIPTION

[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the present invention will be briefly introduced below in combination with the drawings and the description of the embodiments or the prior art. Obviously, the following description of the structure of the drawings is only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention.

[0044] It should be understood that although the terms first, second, etc. may be used herein to describe various units, these units should not be limited by these terms. These terms are only used to distinguish one unit from another unit. For example, a first unit can be referred to as a second unit, and similarly, a second unit can be referred to as a first unit without departing from the scope of the exemplary embodiments of the present invention.

[0045] It should be understood that the term "and / or" that may appear in this article is merely a description of the association relationship between associated objects, indicating that three relationships may exist. For example, A and / or B can represent three situations: A exists alone, B exists alone, and A and B exist at the same time. The term " / and" that may appear in this article describes another type of association object relationship, indicating that two relationships may exist. For example, A / and B can represent two situations: A exists alone, and A and B exist alone. In addition, the character " / " that may appear in this article generally indicates that the previous and next associated objects are in an "or" relationship.

[0046] In order to facilitate the encryption of sensitive data in the text, the embodiments of the present application provide a data encryption method, device and storage medium based on classification identification. The data encryption method, device and storage medium based on classification identification can realize automatic identification and encryption of sensitive data, which greatly facilitates users to encrypt sensitive data in the text.

[0047] The data encryption method based on classification identification provided in the embodiment of the present application can be applied to a user terminal or server for sensitive data encryption. It can be understood that the execution subject does not constitute a limitation on the embodiment of the present application.

[0048] The data encryption method based on classification identification provided in an embodiment of the present application will be described in detail below.

[0049] like Figure 1 As shown, it is a flowchart of the data encryption method based on classification identification provided in the first aspect of the embodiment of the present application. The data encryption method based on classification identification may include but is not limited to the following steps S101-S104.

[0050] Step S101: Obtain the text to be encrypted.

[0051] Step S102: Identify sensitive data in the text to be encrypted using a pre-trained sensitive data identification model, and write the location of the sensitive data in the text to be encrypted into a text information table corresponding to the text to be encrypted.

[0052] In the embodiment of the present application, a sensitive data recognition model for identifying sensitive data in the text to be encrypted is pre-trained. After obtaining the text to be encrypted, the sensitive data in the text to be encrypted can be identified by the pre-trained sensitive data recognition model. In the embodiment of the present application, a text information table for recording the position of sensitive data in the text is also pre-set. After identifying the sensitive data in the text to be encrypted, the position of the sensitive data in the text to be encrypted can also be written into the text information table corresponding to the text to be encrypted. The position of the sensitive data in the text to be encrypted can be known through the data recorded in the text information table.

[0053] The sensitive data identification model is used to identify sensitive data in the text to be encrypted. It can be, but is not limited to, a bidirectional long short-term memory network (Bidirectional Long Short Term Memory, Bi LSTM) model or a conditional random field (conditional random field, CRF) model, which is not specifically limited in the embodiments of the present application.

[0054] When training the sensitive data identification model, a training sample set may be obtained first, wherein the training sample set includes a plurality of sample texts with sensitive data annotated. Then, the sample texts in the training sample set are used as inputs of the neural network model, and the sensitive data annotated in the sample texts are used as outputs for training to obtain a sensitive data identification model. The sensitive data annotated in the sample texts may include, but are not limited to, names of people, company names, contact information, performance data, and / or other data that is not convenient for public disclosure.

[0055] Step S103: Encrypt the sensitive data in the text to be encrypted using the public key in the randomly generated key pair to obtain the encrypted text, and write the identifier corresponding to the key pair into the text information table.

[0056] In the embodiment of the present application, a key pair list may be randomly generated in advance at the encryption end, and the key pair list includes multiple key pairs. When encrypting sensitive data in the encrypted text, an unused first key pair may be selected from the pre-randomly generated key pair list. Then, the sensitive data in the encrypted text is encrypted using the public key in the first key pair.

[0057] It is understandable that after identifying the sensitive data in the text to be encrypted, a second key pair may be randomly generated, and then the sensitive data in the text to be encrypted may be encrypted using the public key in the second key pair. The encryption process of encrypting sensitive data using the public key is not described in detail in the embodiments of the present application.

[0058] After the public key in the pair is used to encrypt the sensitive data in the encrypted text to obtain the encrypted text, the encryption end can also write the identifier corresponding to the secret key pair into the text information table. In this way, when the encrypted sensitive data needs to be decrypted, the key pair used to encrypt the sensitive data can be found through the identifier recorded in the text information table, thereby finding the private key corresponding to the public key and decrypting the encrypted sensitive data.

[0059] In one or more embodiments, the remaining data in the encrypted text except the sensitive data can also be encrypted. That is, after the sensitive data in the encrypted text is identified, the sensitive data in the encrypted text can be encrypted by the public key in the randomly generated third key pair, and the remaining data in the encrypted text except the sensitive data can be encrypted by the public key in the randomly generated fourth key pair to obtain the encrypted text, and the identifier corresponding to the third key pair and the identifier corresponding to the fourth key pair are written into the text information table. In this way, the remaining data except the sensitive data in the encrypted text can also be encrypted, and when the encrypted file needs to be decrypted, the third key pair used to encrypt the sensitive data and the fourth key pair used to encrypt the remaining data except the sensitive data can be found through the identifier recorded in the text information table, so that the private keys in the third key pair and the fourth key pair can be used to decrypt the remaining data except the sensitive data and the sensitive data respectively. At the same time, since the sensitive data and the remaining data except the sensitive data are encrypted by different keys, data security can be further ensured and user data privacy can be effectively protected.

[0060] Step S104: Encrypt the information in the text information table using a preconfigured encryption algorithm.

[0061] The information in the text information table is encrypted through a preconfigured encryption algorithm, so that the identification information of the key pair recorded in the text information table can be encrypted to prevent the relevant information of the key pair from being leaked, thereby ensuring data security and protecting user data privacy.

[0062] In one or more embodiments, after the information in the text information table is encrypted using a preconfigured encryption algorithm, the encrypted information may be associated with the text to be encrypted.

[0063] In summary, the data encryption method based on classification identification provided by the present invention identifies the sensitive data in the text to be encrypted through a pre-trained sensitive data identification model, and writes the position of the sensitive data in the text to be encrypted into the text information table corresponding to the text to be encrypted; encrypts the sensitive data in the text to be encrypted through the public key in the randomly generated key pair to obtain the encrypted text, and writes the identifier corresponding to the key pair into the text information table; encrypts the text information through a pre-configured encryption algorithm. In this way, the sensitive data to be encrypted in the text can be easily and accurately identified, and the sensitive data in the text is encrypted, thereby realizing automatic identification and encryption of sensitive data, which greatly facilitates the encryption of sensitive data in the text by the user. At the same time, encryption is performed by a randomly generated key pair during encryption, so that the user's data privacy can be effectively protected. In addition, the identifier corresponding to the key pair is written into the text information table and the information in the text information table is encrypted by a pre-configured encryption algorithm, so that after the encryption end restores the encrypted information, the corresponding decryption key is found according to the identifier corresponding to the key pair recorded in the text information table, thereby decrypting and restoring the encrypted sensitive data.

[0064] See also Figure 2 According to a second aspect of an embodiment of the present application, a data encryption device based on classification identification is provided. The data encryption device based on classification identification includes:

[0065] An acquisition unit, used for acquiring the text to be encrypted;

[0066] An identification unit, used to identify sensitive data in the text to be encrypted by using a pre-trained sensitive data identification model;

[0067] A writing unit, used for writing the sensitive data at a position in the text to be encrypted into a text information table corresponding to the text to be encrypted;

[0068] An encryption unit, used to encrypt the sensitive data in the text to be encrypted by using a public key in a randomly generated key pair to obtain an encrypted text;

[0069] The writing unit is further used to write the identifier corresponding to the key pair into the text information table;

[0070] The encryption unit is further used to encrypt the information in the text information table using a preconfigured encryption algorithm.

[0071] The working process, working details and technical effects of the device provided in the second aspect of this embodiment can be found in the first aspect of the embodiment and will not be described in detail here.

[0072] like Figure 3As shown, the third aspect of an embodiment of the present application provides another data encryption device based on classification identification, including a memory, a processor and a transceiver that are communicatively connected in sequence, wherein the memory is used to store computer programs, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the data encryption method based on classification identification as described in the first aspect of the embodiment.

[0073] For specific examples, the memory may include but is not limited to random access memory (RAM), read-only memory (ROM), flash memory, first-in-first-out memory (FIFO) and / or first-in-last-out memory (FILO), etc.; the processor may be but is not limited to a microprocessor of the STM32F105 series, an ARM (Advanced RISC-Machines), an X86 or other architecture processor, or a processor with an integrated NPU (neural-network processing units); the transceiver may be but is not limited to a WiFi (Wireless Fidelity) wireless transceiver, a Bluetooth wireless transceiver, a General Packet Radio Service (GPRS) wireless transceiver, a ZigBee protocol (a low-power local area network protocol based on the IEEE802.15.4 standard, ZigBee) wireless transceiver, a 3G transceiver, a 4G transceiver and / or a 5G transceiver, etc.

[0074] The working process, working details and technical effects of the device provided in the third aspect of this embodiment can be found in the first aspect of the embodiment and will not be described in detail here.

[0075] The fourth aspect of this embodiment provides a computer-readable storage medium storing instructions for the data encryption method based on classification identification as described in the first aspect of the embodiment, that is, the computer-readable storage medium stores instructions, and when the instructions are run on a computer, the data encryption method based on classification identification as described in the first aspect is executed. The computer-readable storage medium refers to a carrier for storing data, which may include but is not limited to a floppy disk, an optical disk, a hard disk, a flash memory, a USB flash drive and / or a memory stick, etc., and the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.

[0076] The fifth aspect of this embodiment provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the data encryption method based on classification identification as described in the first aspect of the embodiment, wherein the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.

[0077] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A data encryption method based on classification identification, It is characterized in that include: Get the text to be encrypted; Identify the sensitive data in the text to be encrypted by using a pre-trained sensitive data identification model, and write the position of the sensitive data in the text to be encrypted into a text information table corresponding to the text to be encrypted; Encrypting the sensitive data in the text to be encrypted by using the public key in the randomly generated key pair to obtain the encrypted text, and writing the identifier corresponding to the key pair into the text information table, so as to find the key pair used to encrypt the sensitive data based on the identifier recorded in the text information table; The information in the text information table is encrypted using a preconfigured encryption algorithm.

2. The data encryption method based on classification identification according to claim 1, It is characterized in that Before identifying the sensitive data in the to-be-encrypted text by using the pre-trained sensitive data identification model, the method further includes: Obtaining a training sample set, wherein the training sample set includes a plurality of sample texts with labeled sensitive data; The sample text in the training sample set is used as the input of the neural network model, and the sensitive data marked in the sample text is used as the output for training to obtain the sensitive data recognition model.

3. The data encryption method based on classification identification according to claim 1, It is characterized in that The step of encrypting the sensitive data in the text to be encrypted by using the public key in the randomly generated key pair includes: Selecting an unused first key pair from a pre-randomly generated key pair list; The sensitive data in the text to be encrypted is encrypted using the public key in the first key pair.

4. The data encryption method based on classification identification according to claim 1, It is characterized in that The step of encrypting the sensitive data in the text to be encrypted by using the public key in the randomly generated key pair includes: randomly generating a second key pair; The sensitive data in the text to be encrypted is encrypted using the public key in the second key pair.

5. The data encryption method based on classification identification according to claim 1, It is characterized in that The method of encrypting the sensitive data in the text to be encrypted by using the public key in the randomly generated key pair to obtain the encrypted text, and writing the identifier corresponding to the key pair into the text information table includes: The sensitive data in the text to be encrypted is encrypted by using the public key in the randomly generated third key pair, and the remaining data in the text to be encrypted except the sensitive data is encrypted by using the public key in the randomly generated fourth key pair to obtain the encrypted text, and the identifier corresponding to the third key pair and the identifier corresponding to the fourth key pair are written into the text information table.

6. The data encryption method based on classification identification according to claim 1, It is characterized in that The sensitive data identification model is a bidirectional long short-term memory network model or a conditional random field model.

7. The data encryption method based on classification identification according to claim 1, It is characterized in that After encrypting the information in the text information table by using a preconfigured encryption algorithm, the method further includes: The encrypted information is associated with the text to be encrypted.

8. A data encryption device based on classification identification, It is characterized in that include: An acquisition unit, used for acquiring the text to be encrypted; An identification unit, used to identify sensitive data in the text to be encrypted by using a pre-trained sensitive data identification model; A writing unit, used for writing the sensitive data at a position in the text to be encrypted into a text information table corresponding to the text to be encrypted; An encryption unit, used to encrypt the sensitive data in the text to be encrypted by using a public key in a randomly generated key pair to obtain an encrypted text; The writing unit is further used to write the identifier corresponding to the key pair into the text information table, so as to find the key pair used to encrypt the sensitive data based on the identifier recorded in the text information table; The encryption unit is further used to encrypt the information in the text information table using a preconfigured encryption algorithm.

9. A data encryption device based on classification identification, It is characterized in that It comprises a memory, a processor and a transceiver which are communicatively connected in sequence, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the data encryption method based on classification identification as described in any one of claims 1 to 7.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed on a computer, the data encryption method based on classification identification as described in any one of claims 1 to 7 is executed.