WO2021027134A1 - 数据存储方法、装置、设备和计算机存储介质 - Google Patents

数据存储方法、装置、设备和计算机存储介质 Download PDF

Info

Publication number
WO2021027134A1
WO2021027134A1 PCT/CN2019/117198 CN2019117198W WO2021027134A1 WO 2021027134 A1 WO2021027134 A1 WO 2021027134A1 CN 2019117198 W CN2019117198 W CN 2019117198W WO 2021027134 A1 WO2021027134 A1 WO 2021027134A1
Authority
WO
WIPO (PCT)
Prior art keywords
text data
ciphertext
key name
sensitive information
preset
Prior art date
Application number
PCT/CN2019/117198
Other languages
English (en)
French (fr)
Inventor
莫鹏程
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021027134A1 publication Critical patent/WO2021027134A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/31Indexing; Data structures therefor; Storage structures
    • G06F16/316Indexing structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • G06F21/6245Protecting personal data, e.g. for financial or medical purposes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2107File encryption

Definitions

  • This application relates to the field of data security, in particular to data storage methods, devices, equipment and computer storage media.
  • the localStorage feature of the fifth version of the application hypertext markup language is used for storage.
  • the data storage method of local storage in local storage is a key-value pair method, that is, after storing a piece of text data with a fixed key value, you can query the local storage to read the corresponding data through the key value; currently, the local storage in the browser localStorage Data storage is stored in plaintext, and the front-end page running environment is open and easy to view, which leads to the risk of leakage and theft of data stored in localStorage. Therefore, how to improve data security is currently urgently needed problem.
  • the main purpose of this application is to provide a data storage method, device, equipment, and computer storage medium, aiming to solve the current technical problem of low data security in local storage.
  • this application provides a data storage method, which includes the following steps:
  • the terminal obtains the text data to be stored, and assigns a key name to the text data;
  • the ciphertext key name and the ciphertext text data are associated and stored in the local storage of the terminal.
  • the present application also provides a data storage device, the data storage device includes:
  • Obtaining and distributing module used for obtaining the text data to be stored, and assigning key names to the text data
  • the key name encryption module is used to perform encryption processing on the key name according to the first preset encryption algorithm to obtain the ciphertext key name;
  • the text encryption module is configured to perform encryption processing on the text data according to a second preset encryption algorithm when the text data contains sensitive information to obtain ciphertext text data;
  • the associative storage module is used for associative storage of the ciphertext key name and the ciphertext text data in the local storage of the terminal.
  • this application also provides a data storage device
  • the data storage device includes: a memory, a processor, and computer-readable instructions stored on the memory and running on the processor, wherein:
  • this application also provides a computer storage medium
  • the computer storage medium stores computer readable instructions, and when the computer readable instructions are executed by a processor, the steps of the above data storage method are realized.
  • a data storage method, device, device, and computer storage medium are proposed in the embodiments of the application.
  • the terminal obtains the text data to be stored, and assigns a key name to the text data; the key name is performed according to the first preset encryption algorithm Encryption processing to obtain a ciphertext key name; when the text data contains sensitive information, encrypt the text data according to a second preset encryption algorithm to obtain ciphertext text data; combine the ciphertext key name with The ciphertext text data is associated and stored in the local storage of the terminal.
  • the terminal encrypts the key name to form a ciphertext key name, and encrypts text data to form ciphertext text data, which effectively reduces the risk of the text data stored in the local memory being leaked or stolen, and improves the local Security of data in storage.
  • FIG. 1 is a schematic diagram of the device structure of the hardware operating environment involved in the solution of the embodiment of the present application;
  • FIG. 3 is a schematic flowchart of a second embodiment of a data storage method according to this application.
  • FIG. 4 is a schematic diagram of functional modules of an embodiment of a data storage device according to the present application.
  • Figure 1 is a terminal (also called a data storage device) of the hardware operating environment involved in the solution of the embodiment of the application.
  • the data storage device can be composed of a separate data storage device, or can be composed of other devices and
  • the data storage device is combined to form a structure diagram.
  • the terminal in the embodiment of this application can be a fixed terminal or a mobile terminal, such as smart air conditioners with networking functions, smart lights, smart power supplies, smart speakers, autonomous vehicles, and PCs.
  • smart air conditioners with networking functions, smart lights, smart power supplies, smart speakers, autonomous vehicles, and PCs.
  • PCs personal computer
  • personal computers smart phones, tablet computers, e-book readers, portable computers, etc.
  • the terminal may include: a processor 1001, for example, a central processing unit Unit, CPU), network interface 1004, user interface 1003, memory 1005, communication bus 1002.
  • the communication bus 1002 is used to implement connection and communication between these components.
  • the user interface 1003 may include a display screen (Display) and an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface.
  • the network interface 1004 may optionally include a standard wired interface and a wireless interface (such as WIreless-FIdelity, WIFI interface).
  • the memory 1005 can be a high-speed RAM memory or a stable memory (non-volatile memory), for example, disk storage.
  • the memory 1005 may also be a storage device independent of the foregoing processor 1001.
  • the terminal may also include a camera, RF (Radio Frequency, radio frequency) circuit, sensor, audio circuit, WiFi module; input unit, display screen, touch screen; network interface can be selected except WiFi, Bluetooth, probe and so on.
  • sensors such as light sensors, motion sensors and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor; of course, the mobile terminal may also be equipped with other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc., which will not be repeated here.
  • terminal structure shown in FIG. 1 does not constitute a limitation on the terminal, and may include more or fewer components than shown in the figure, or combine some components, or arrange different components.
  • the computer software product is stored in a storage medium (storage medium: also called computer storage medium, computer medium, readable medium, readable storage medium, computer readable storage medium, or directly called medium, etc., storage medium
  • storage medium can be a non-volatile readable storage medium, such as RAM, magnetic disk, optical disk, and includes several instructions to make a terminal device (can be a mobile phone, computer, server, air conditioner, or network device, etc.) execute this application
  • the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and computer-readable instructions.
  • the network interface 1004 is mainly used to connect to a background server and perform data communication with the background server;
  • the user interface 1003 is mainly used to connect to a client (user side) and perform data communication with the client;
  • the processor 1001 can be used to call computer-readable instructions stored in the memory 1005 and execute the steps in the data storage method provided in the following embodiments of the present application.
  • the first embodiment of the data storage method of the present application is proposed, and the data storage method in this embodiment is applied to the terminal.
  • the data storage method includes:
  • Step S10 The terminal obtains the text data to be stored, and assigns a key name to the text data.
  • the user triggers an operation request on the terminal, where the operation request can be understood as the user running a hybrid application computer readable instruction (APP, Application, that is, through a browser (such as Chrome Google browser, Firefox browser)
  • APP application computer readable instruction
  • the underlying architecture is the computer-readable instructions of the native application, and the page is displayed as a web page loading request triggered by the client Webview (web page, web view, web view) of the application hypertext markup language page (H5 page).
  • the server receives the operation request, The server obtains the page identifier in the operation request, loads the front-end page data information corresponding to the page identifier, the server uses the front-end page data information as text data, and the server returns the loaded text data to the terminal.
  • the terminal obtains the text data fed back by the server, and the terminal caches the text data in the local storage localStorage according to the local storage feature defined in HTML5 (ie, the fifth version of Hypertext Markup Language), and assigns key names to the text data.
  • HTML5 ie, the fifth version of Hypertext Markup Language
  • Step S20 Encrypt the key name according to the first preset encryption algorithm to obtain the ciphertext key name.
  • a first preset encryption algorithm for encrypting key names is preset in the terminal, where the first preset encryption algorithm includes but is not limited to DES algorithm, 3DES algorithm, TDEA algorithm, and MD5 message digest algorithm.
  • the terminal determines the key of the text data. After the name, the terminal encrypts the key name according to the first preset encryption algorithm.
  • the MD5 message digest algorithm encrypts the key name as an example to illustrate the key name encryption process, which specifically includes:
  • Step a1 splicing offset character strings after the key name to obtain spliced key names that meet preset conditions
  • Step a2 Convert the splicing key name into a hash value with a preset number of bits according to the MD5 message digest algorithm to obtain the ciphertext key name.
  • the terminal splices the offset character string at the end of the key name to obtain the spliced key name, where the number of bits and content of the offset character string can be set based on the actual situation; the terminal is based on the MD5 message
  • the digest algorithm converts the splicing key name into a 128-bit hash value to obtain the ciphertext key name;
  • the terminal fills a 1 and an infinite number of 0s at the end of the key name until the bit length of the first key name obtained by filling satisfies a preset condition, and then the terminal adds a preset number of bits to the end of the first key name.
  • the bit length of the key name before padding the second key name whose bit length is an integer multiple of 512 is obtained, and the MD5 operation is performed on the second key name to obtain the ciphertext key name.
  • the preset condition refers to the preset length condition of the splicing key name
  • the preset condition is N*512+448, N is a non-negative integer or 0;
  • a preset number of bits is added to the end of the third key name to represent the bit length of the key name before filling, and the bit length is an integer multiple of 512
  • the fourth key name, and MD5 operation is performed on the fourth key name to obtain the ciphertext key name.
  • the encryption effect can be improved and the security of the key name can be improved.
  • the terminal determines whether the acquired text data contains sensitive information; that is, the preset sensitive information set in the terminal, the preset sensitive information set contains different types of sensitive information; the terminal converts the information in the text data Perform word segmentation to obtain the corresponding word set. Then, the terminal compares the words in the word set with the sensitive information in the preset sensitive information set. When there is sensitive information in the word set, it is determined that the text data contains sensitive information. on the contrary.
  • the terminal After the terminal determines that the text data contains sensitive information, the terminal performs encryption processing on the text data, which specifically includes:
  • Step S30 When the text data contains sensitive information, the text data is encrypted according to a second preset encryption algorithm to obtain ciphertext text data.
  • a preset second encryption algorithm for encrypting text data is preset in the terminal.
  • the preset second encryption algorithm includes symmetric encryption algorithm and asymmetric encryption algorithm.
  • Symmetric encryption algorithms include but are not limited to DES algorithm, 3DES algorithm, TDEA algorithm, Blowfish Algorithm, RC5 algorithm and IDEA algorithm
  • asymmetric encryption algorithm includes but not limited to SHA256 algorithm, RSA algorithm, Elgamal algorithm, knapsack algorithm, Rabin algorithm, DH algorithm, ECC algorithm (elliptic curve encryption algorithm).
  • the symmetric algorithm DES algorithm for encrypting text data is taken as an example to illustrate the encryption process.
  • the DES algorithm has three entry parameters: Key, Data, and Mode. Key is 7 bytes and 56 bits in total.
  • the working key of the DES algorithm; Data is 8 bytes and 64 bits, which is the data to be encrypted or decrypted; Mode is the working mode of DES, there are two ways: encryption or decryption, the specific encryption process is to press the text data Bit recombination, and the output is divided into two parts, L0 and R0, each part is 32 bits long, and then the 56-bit working key is divided into two parts, each part is 28 bits, and the two parts are encrypted based on the number of encryption rounds.
  • the key is rotated by 1 or 2 bits to the left, and then the right half of the 32-bit input R0 is expanded to 48-bit output, and data of the same length as the key is generated for XOR operation, and the split key is expanded with
  • the text data after the number of digits is XORed to obtain the result of the operation, and the result of the operation is sent to the S box, and the substitution operation is performed to obtain a 32-bit substitution operation result (the substitution is completed by 8 different S boxes, each S box The box has 6-bit input and 4-bit output.
  • the 48-bit input is divided into 8 6-bit groups, one group corresponds to an S box, and the corresponding S box performs the substitution operation for each group), and finally the replacement operation result is according to the P box Perform permutation and XOR the result of the P-box permutation with the left half of the initial 64-bit packet L0, then swap the left and right halves, and then start another round until the last round gets R16 and L16, and R16 and L16 is used as input to perform inverse permutation to obtain ciphertext text data.
  • sensitive information includes but is not limited to customer name, ID number (ID number), date of birth, contact address, contact phone number, email address, bank card number, social account number, and customer contact information.
  • step S20 it also includes:
  • Step b1 when the text data does not contain sensitive information, determine whether the text data contains a preset label
  • Step b2 when the text data includes a preset label, encrypt the text data according to a second preset encryption algorithm to obtain ciphertext text data;
  • Step b3 storing the ciphertext key name and the ciphertext text data in a local memory of the terminal in association with each other.
  • the terminal determines whether the text data contains a preset label; wherein, the preset label refers to a preset feature label, and when the text data contains a preset label, the text data Encryption processing is performed according to the second preset encryption algorithm to obtain the ciphertext text data; the ciphertext key name and the ciphertext text data are associated and stored in the local memory of the terminal.
  • the special page is set with a preset label, and the terminal can Encrypt the text data of the page to prevent omissions in judging whether the encryption is only based on the content of the text data.
  • Step S40 Store the ciphertext key name and the ciphertext text data in a local memory of the terminal in association with each other.
  • the terminal associates the encrypted ciphertext key name with the ciphertext text data and stores it in the local memory of the terminal; in this embodiment, the terminal encrypts the key name to form a ciphertext key name, and encrypts the text data to form ciphertext text data.
  • the ciphertext key name is obtained.
  • the ciphertext key name needs to be decrypted before the corresponding key name can be obtained.
  • the terminal obtains the ciphertext text data corresponding to the key name.
  • the corresponding text data can be obtained by decrypting the ciphertext text data, which effectively reduces the risk of the text data stored in the local storage being leaked and stolen, and improves the security of the data in the local storage.
  • This embodiment is a refinement of step S30 in the first embodiment.
  • the data storage method includes:
  • Step S31 When the text data contains sensitive information, it is determined whether the number of bytes of the text data exceeds a preset number of bytes.
  • the terminal determines that the text data contains sensitive information
  • the terminal obtains the text data, calculates the number of bytes corresponding to the text data, and judges whether the number of bytes of the text data exceeds the preset number of bytes, where the preset number of bytes can be based on Flexible setting of application scenarios.
  • the terminal directly performs all encryption processing on the text data.
  • Step S32 when the number of bytes of the text data exceeds the preset number of bytes, extract sensitive information in the text data, and establish a mapping relationship table between the sensitive information and its occupied position.
  • the terminal When the terminal determines that the number of bytes of text data exceeds the preset number of bytes, the terminal directly encrypts the entire text data, and the amount of data that needs to be encrypted is relatively large. At this time, the terminal extracts sensitive information from the text data and determines The position occupied by the sensitive information in the text data, the terminal establishes a mapping relationship table between the sensitive information and the occupied position, then deletes the sensitive information in the text data, and marks the position occupied by the sensitive information in the text data to obtain Desensitize text data.
  • Step S33 Perform encryption processing on the extracted sensitive information and the mapping table according to a second preset encryption algorithm to obtain ciphertext sensitive information.
  • the terminal encrypts the extracted sensitive information and the projected relationship table according to the second preset encryption algorithm to obtain the ciphertext sensitive information, where the second preset encryption algorithm is the same as that in the first embodiment, which is not used in this embodiment. Repeat.
  • the terminal After the terminal encrypts the sensitive information in the text data, the terminal needs to perform associated storage, which specifically includes:
  • Step S41 Use text data that does not contain sensitive information as desensitized text data, encapsulate the desensitized text data and the ciphertext sensitive information into a data packet, and associate the data packet with the ciphertext key name Stored in the local storage of the terminal.
  • the terminal uses text data that does not contain sensitive information as desensitized text data, and the terminal encapsulates the desensitized text data and ciphertext sensitive information into data packets, and stores the data packets in association with ciphertext keys in the local storage of the terminal.
  • the terminal calculates the number of bytes of the text data, and determines whether the number of bytes is greater than the preset number of bytes, When the number of bytes is greater than the preset number of bytes, the terminal extracts sensitive information from the text data to obtain desensitized text data, and determines the position occupied by the sensitive information in the text data, and establishes a relationship between the sensitive information and the occupied position.
  • the terminal encrypts the extracted sensitive information and the mapping relationship table through a second preset algorithm to obtain ciphertext sensitive information, and combines the ciphertext sensitive information and desensitized text data into one data packet; After obtaining the data packet, the terminal associates the ciphertext key name with the data packet and stores it locally.
  • the data storage method in this embodiment includes:
  • Step S50 When receiving the text reading instruction, obtain the identity verification information and the ciphertext key name corresponding to the text reading instruction.
  • the terminal When the user triggers a webpage loading instruction based on the browser on the terminal, the terminal obtains the page identification corresponding to the webpage loading instruction, the terminal determines whether the text data corresponding to the page identification is contained in the local storage, and the terminal determines that the local storage contains the corresponding page identification
  • the terminal receives a text read instruction, and the terminal obtains the identity verification information and ciphertext key name corresponding to the text read instruction, where the identity verification information refers to preset user account information, or user biometric information, etc.
  • the terminal can perform user identity verification based on the identity verification information.
  • Step S60 when the identity verification information is verified, obtain the first preset decryption algorithm corresponding to the ciphertext key name, and decrypt the ciphertext key name based on the first preset decryption algorithm to obtain the key name .
  • the terminal determines that the authentication information is passed, the terminal obtains the ciphertext key name and the first preset encryption algorithm corresponding to the ciphertext key name, the terminal obtains the first preset decryption algorithm corresponding to the first preset encryption algorithm, and The ciphertext key name is decrypted by the first preset decryption algorithm to obtain the key name.
  • Step S70 Obtain the data packet corresponding to the key name, extract the ciphertext sensitive information and the desensitized text data from the data packet; obtain the second preset decryption algorithm corresponding to the ciphertext sensitive information, according to the first 2.
  • the preset decryption algorithm decrypts the ciphertext sensitive information to obtain the sensitive information and the sensitive mapping relationship table.
  • the terminal obtains the data packet corresponding to the key name in the local storage, and extracts the ciphertext sensitive information and the desensitized text data from the data packet; then, the terminal obtains the ciphertext sensitive information and the second preset encryption algorithm corresponding to the ciphertext sensitive information
  • the terminal obtains the second preset decryption algorithm corresponding to the second preset encryption algorithm, and decrypts the ciphertext sensitive information according to the second preset decryption algorithm, to obtain the sensitive information contained in the ciphertext sensitive information and the sensitive mapping relationship table.
  • Step S80 Filling the sensitive information into the desensitized text data according to the mapping relationship table to obtain the text data corresponding to the read instruction.
  • the terminal fills the sensitive information into the desensitized text data according to the mapping relationship table, and obtains the text data corresponding to the read instruction.
  • the terminal combines the decrypted desensitized text data and sensitive information, which facilitates the viewing of the text data.
  • This embodiment is a step after step S30 in the first embodiment, and the data storage method includes:
  • Step S90 When it is detected that the available storage capacity of the local storage is lower than the preset storage threshold, the attributes of each text data in the local storage are acquired.
  • the terminal monitors the available storage space in the local storage in real time.
  • the preset storage threshold refers to the preset storage threshold, for example, the preset storage
  • the threshold is set to 10M, and the terminal obtains the attributes of each text data in the local storage, where the attributes include but are not limited to creation time, access time, modification time, and occupied space.
  • Step S100 Determine the target text data to be deleted according to the creation time, access time and modification time of each text data, and delete the target text data in the local storage.
  • the terminal determines the target text data to be deleted according to the creation time, access time, and modification time of each text data, that is, the terminal takes the text data with the creation time first, access time first, modification time first, or the largest space occupation as the target Text data, and delete the target text data in the local storage.
  • the text data in the local storage space is updated by deleting the target text data in the local storage space.
  • an embodiment of the present application also proposes a data storage device, and the data storage device includes:
  • the obtaining and distributing module 10 is used for obtaining the text data to be stored, and assigning key names to the text data;
  • the key name encryption module 20 is configured to perform encryption processing on the key name according to the first preset encryption algorithm to obtain the ciphertext key name;
  • the text encryption module 30 is configured to perform encryption processing on the text data according to a second preset encryption algorithm when the text data contains sensitive information to obtain ciphertext text data;
  • the associative storage module 40 is configured to associate and store the ciphertext key name and the ciphertext text data in the local storage of the terminal.
  • the first preset encryption algorithm includes an MD5 message digest algorithm
  • the key name encryption module 20 includes:
  • the key name adding unit is used to splice the offset character string after the key name to obtain the spliced key name that meets the preset conditions;
  • the first encryption unit is configured to convert the splicing key name into a hash value with a preset number of bits according to the MD5 message digest algorithm to obtain the ciphertext key name.
  • the text encryption module 30 includes:
  • a byte judging unit for judging whether the number of bytes of the text data exceeds a preset number of bytes when the text data contains sensitive information
  • An extracting and mapping unit for extracting sensitive information in the text data when the number of bytes of the text data exceeds a preset number of bytes, and establishing a mapping relationship table between the sensitive information and its occupied position;
  • the second encryption unit is configured to perform encryption processing on the extracted sensitive information and the mapping relationship table according to a second preset encryption algorithm to obtain ciphertext sensitive information;
  • the associated storage module 40 is configured to use text data that does not contain sensitive information as desensitized text data, encapsulate the desensitized text data and the ciphertext sensitive information into a data packet, and combine the data packet with all the sensitive information.
  • the ciphertext key name is associated and stored in the local storage of the terminal.
  • the data storage device includes:
  • the instruction receiving module is configured to obtain the identity verification information and the ciphertext key name corresponding to the text reading instruction when the text reading instruction is received;
  • the first decryption module is configured to obtain a first preset decryption algorithm corresponding to the ciphertext key name when the identity verification information is verified, and decrypt the ciphertext key name based on the first preset decryption algorithm , Get the key name;
  • An information extraction module configured to obtain a data packet corresponding to the key name, and extract ciphertext sensitive information and desensitized text data from the data packet;
  • the second decryption module is configured to obtain a second preset decryption algorithm corresponding to the ciphertext sensitive information, decrypt the ciphertext sensitive information according to the second preset decryption algorithm, to obtain sensitive information and a sensitive mapping relationship table;
  • the information filling module is used to fill the sensitive information into the desensitized text data according to the mapping relationship table to obtain the text data corresponding to the read instruction.
  • the data storage device includes:
  • An information receiving module configured to receive editing information input based on the text data, and use the text data and the editing information corresponding to the text data as new text data;
  • the update saving module is used to save the new text data to the local storage of the terminal.
  • the data storage device includes:
  • the label judgment module is used to judge whether the text data contains a preset label when the text data does not contain sensitive information
  • the second encryption module is configured to perform encryption processing on the text data according to a second preset encryption algorithm when the text data includes a preset label to obtain ciphertext text data;
  • the associative storage module is used for associative storage of the ciphertext key name and the ciphertext text data in the local storage of the terminal.
  • the data storage device includes:
  • the detection and acquisition module is used to acquire the attributes of each text data in the local memory when it is detected that the available storage capacity of the local memory is lower than the preset storage threshold, where the attributes include creation time, access time and modification time;
  • the confirm deletion module is used to determine the target text data to be deleted according to the creation time, access time and modification time of each text data, and delete the target text data in the local storage.
  • the embodiment of the present application also proposes a computer storage medium, which may be a non-volatile computer-readable storage medium.
  • the computer storage medium stores computer readable instructions, and when the computer readable instructions are executed by a processor, the operations in the data storage method provided in the foregoing embodiments are implemented.
  • the description is relatively simple, and for related parts, please refer to the part of the description of the method embodiment.
  • the device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separate. Some or all of the modules can be selected according to actual needs to achieve the objectives of the solution of the present application. Those of ordinary skill in the art can understand and implement it without creative work.

Abstract

一种数据存储方法、装置、设备和计算机存储介质,所述方法包括以下步骤:终端获取待存储的文本数据,为所述文本数据分配键名(S10);将所述键名按第一预设加密算法进行加密处理,得到密文键名(S20);在所述文本数据中包含敏感信息时,将所述文本数据按第二预设加密算法进行加密处理,得到密文文本数据(S30);将所述密文键名与所述密文文本数据关联存储在所述终端的本地存储器(S40)。该方法将本地存储器中的键名和文本数据进行加密存储,提高了本地存储数据的安全性。

Description

数据存储方法、装置、设备和计算机存储介质
本申请要求于2019年8月14日提交中国专利局、申请号为201910761802.7、发明名称为“数据存储方法、装置、设备和计算机存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及数据安全领域,尤其涉及数据存储方法、装置、设备和计算机存储介质。
背景技术
前端网页开发中,均使用应用超文本标记语言第五版本的本地存储器localStorage特性进行存储。
本地存储器localStorage数据存储的方式为键值对方式,即以一个固定键值存储了一段文本数据后,查询本地存储器,就可以通过键值读取对应的数据;目前,浏览器内的本地存储器localStorage数据存储均以明文方式存储,且前端页面运行环境具有开放、易查看的特点,导致本地存储器localStorage存储的数据有被泄露、盗取的风险,因此,如何提高数据的安全性是目前亟待解决的问题。
发明内容
本申请的主要目的在于提供一种数据存储方法、装置、设备和计算机存储介质,旨在解决当前本地存储器中数据安全性低的技术问题。
为实现上述目的,本申请提供数据存储方法,所述数据存储方法包括以下步骤:
终端获取待存储的文本数据,为所述文本数据分配键名;
将所述键名按第一预设加密算法进行加密处理,得到密文键名;
在所述文本数据中包含敏感信息时,将所述文本数据按第二预设加密算法进行加密处理,得到密文文本数据;
将所述密文键名与所述密文文本数据关联存储在所述终端的本地存储器。
此外,为实现上述目的,本申请还提供一种数据存储装置,所述数据存储装置包括:
获取分配模块,用于获取待存储的文本数据,为所述文本数据分配键名;
键名加密模块,用于将所述键名按第一预设加密算法进行加密处理,得到密文键名;
文本加密模块,用于在所述文本数据中包含敏感信息时,将所述文本数据按第二预设加密算法进行加密处理,得到密文文本数据;
关联存储模块,用于将所述密文键名与所述密文文本数据关联存储在所述终端的本地存储器。
此外,为实现上述目的,本申请还提供一种数据存储设备;
所述数据存储设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机可读指令,其中:
所述计算机可读指令被所述处理器执行时实现如上所述的数据存储方法的步骤。
此外,为实现上述目的,本申请还提供计算机存储介质;
所述计算机存储介质上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现如上述的数据存储方法的步骤。
本申请实施例提出的一种数据存储方法、装置、设备和计算机存储介质,终端获取待存储的文本数据,为所述文本数据分配键名;将所述键名按第一预设加密算法进行加密处理,得到密文键名;在所述文本数据中包含敏感信息时,将所述文本数据按第二预设加密算法进行加密处理,得到密文文本数据;将所述密文键名与所述密文文本数据关联存储在所述终端的本地存储器。本申请实施例中终端将键名进行加密形成密文键名,将文本数据进行加密形成密文文本数据,有效地降低了本地存储器中存储的文本数据被泄露、盗取的风险,提高了本地存储中数据的安全性。
附图说明
图1是本申请实施例方案涉及的硬件运行环境的装置结构示意图;
图2为本申请数据存储方法第一实施例的流程示意图;
图3为本申请数据存储方法第二实施例的流程示意图;
图4为本申请数据存储装置一实施例的功能模块示意图。
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
如图1所示,图1是本申请实施例方案涉及的硬件运行环境的终端(又叫数据存储设备,其中,数据存储设备可以是由单独的数据存储装置构成,也可以是由其他装置与数据存储装置组合形成)结构示意图。
本申请实施例终端可以固定终端,也可以是移动终端,如,带联网功能的智能空调、智能电灯、智能电源、智能音箱、自动驾驶汽车、PC (personal computer)个人计算机、智能手机、平板电脑、电子书阅读器、便携计算机等。
如图1所示,该终端可以包括:处理器1001,例如,中央处理器Central Processing Unit,CPU),网络接口1004,用户接口1003,存储器1005,通信总线1002。其中,通信总线1002用于实现这些组件之间的连接通信。用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选用户接口1003还可以包括标准的有线接口、无线接口。网络接口1004可选的可以包括标准的有线接口、无线接口(如无线保真WIreless-FIdelity,WIFI接口)。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如,磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储装置。
可选地,终端还可以包括摄像头、RF(Radio Frequency,射频)电路,传感器、音频电路、WiFi模块;输入单元,比显示屏,触摸屏;网络接口可选除无线接口中除WiFi外,蓝牙、探针等等。其中,传感器比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器;当然,移动终端还可配置陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。
本领域技术人员可以理解,图1中示出的终端结构并不构成对终端的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
如图1所示,该计算机软件产品存储在一个存储介质(存储介质:又叫计算机存储介质、计算机介质、可读介质、可读存储介质、计算机可读存储介质或者直接叫介质等,存储介质可以是非易失性可读存储介质,如RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法,作为一种计算机存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及计算机可读指令。
在图1所示的终端中,网络接口1004主要用于连接后台服务器,与后台服务器进行数据通信;用户接口1003主要用于连接客户端(用户端),与客户端进行数据通信;而处理器1001可以用于调用存储器1005中存储的计算机可读指令,并执行本申请以下实施例提供的数据存储方法中的步骤。
基于上述硬件运行环境的终端描述,提出了本申请数据存储方法的第一实施例,本实施例中的数据存储方法应用于终端。
参照图2,在本申请数据存储方法的第一实施例中,所述数据存储方法包括:
步骤S10,终端获取待存储的文本数据,为所述文本数据分配键名。
在本实施例中,用户在终端上触发操作请求,其中,操作请求可以理解为用户通过浏览器(如Chrome谷歌浏览器、FireFox火狐浏览器)、运行混合应用计算机可读指令(APP,Application即底层架构为原生应用计算机可读指令,页面展示为应用超文本标记语言页面H5页面)的客户端Webview(网页、网络视图、网页视图)等触发的网页加载请求,在服务器接收到操作请求时,服务器获取操作请求中的页面标识,加载页面标识对应的前端页面数据信息,服务器将前端页面数据信息作为文本数据,服务器将加载得到文本数据返回至终端。
终端获取服务器反馈的文本数据,终端按照HTML5(即,应用超文本标记语言的第五版本)中定义的本地存储器localStorage特性,将文本数据缓存至本地存储器localStorage中,并为文本数据分配键名。
步骤S20,将所述键名按第一预设加密算法进行加密处理,得到密文键名。
终端中预先设置有对键名加密的第一预设加密算法,其中,第一预设加密算法包括但不限于DES算法、3DES算法、TDEA算法和MD5消息摘要算法,在终端确定文本数据的键名之后,终端按照第一预设加密算法对该键名进行加密。
本实施例中以MD5消息摘要算法对键名进行加密为例,说明键名加密过程,具体地,包括:
步骤a1,在所述键名后拼接偏移量字符串,得到符合预设条件的拼接键名;
步骤a2,将所述拼接键名按所述MD5消息摘要算法转换为预设位数的散列值,得到密文键名。
即,终端在键名加密过程中,终端在键名末尾拼接偏移量字符串,得到拼接键名,其中,偏移量字符串的位数和内容可基于实际情况进行设置;终端基于MD5消息摘要算法,将该拼接键名转换为128位的散列值,从而得到密文键名;
具体地,终端在键名的末尾填充一个1和无数个0,直到填充得到的第一键名的位长满足预设条件,然后,终端在第一键名的末尾附加预设位数的用于表示填充前的键名的位长,得到位长为512整数倍的第二键名,并对第二键名进行MD5运算,从而得到密文键名。其中,预设条件是指预先设置的拼接键名长度条件,预设条件为N*512+448,N为非负整数或0;预设位数为预先设置的散列值位数,预设位数为N*512+448+64=(N+1)*512。直到填充得到的第三键名的位长满足预设条件,然后在第三键名的末尾附加预设位数的用于表示填充前的键名的位长,得到位长为512整数倍的第四键名,并对第四键名进行MD5运算,从而得到密文键名。本实施例是通过在键名末尾拼接偏移量字符串,可以提高加密效果,提高键名的安全性。
在键名加密完成之后,终端判断获取的文本数据中是否包含敏感信息;即,终端中预设敏感信息集合,预设敏感信息集合中包含有不同类型的敏感信息;终端将文本数据中的信息进行分词处理,得到对应的词语集合,然后,终端将词语集合中的词语与预设敏感信息集合中的敏感信息进行比对,在词语集合中存在敏感信息时,确定文本数据中包含敏感信息,反之。
在终端确定文本数据中包含敏感信息之后,终端对文本数据进行加密处理,具体地,包括:
步骤S30,在所述文本数据中包含敏感信息时,将所述文本数据按第二预设加密算法进行加密处理,得到密文文本数据。
终端中预设对文本数据进行加密的预设第二加密算法,预设第二加密算法包括对称加密算法和非对称加密算法,对称加密算法包括但不限于DES算法、3DES算法、TDEA算法、Blowfish算法、RC5算法和IDEA算法,非对称加密算法包括但不限于SHA256算法、RSA算法、Elgamal算法、背包算法、Rabin算法、D-H算法、ECC算法(椭圆曲线加密算法)。在终端确定文本数据中包含敏感信息时,终端按照预设第二加密算法对文本数据进行加密,得到密文文本数据。
具体地,本实施例中以对称算法DES算法对文本数据进行加密为例,说明加密过程,DES算法的入口参数有三个:Key、Data和Mode,其中Key为7个字节共56位,是DES算法的工作密钥;Data为8个字节64位,是要被加密或被解密的数据;Mode为DES的工作方式,有两种:加密或解密,具体加密过程为将该文本数据按位重新组合,并将输出分为L0和R0两部分,每部分各长32位,然后将56位的工作密钥分成两部分,每部分28位,并基于加密轮数将两部分的工作密钥循环左移1位或2位,然后将32位输入的右半部分R0扩展为48位输出,生成与密钥相同长度的数据以进行异或运算,并将拆分后的密钥与扩展位数后的文本数据进行异或运算,得到运算结果,且将该运算结果送入S盒,进行替代运算,得到32位的替代运算结果(替代由8个不同的S盒完成,每个S盒有6位输入和4位输出,48位输入分为8个6位的分组,一个分组对应一个S盒,对应的S盒对各组进行代替操作),最后将该替代运算结果按照P盒进行置换,并将P盒置换的结果与最初的64位分组左半部分L0异或,然后左、右半部分交换,接着开始另一轮,直到最后一轮得到R16和L16,并将R16和L16作为输入,进行逆置换,从而得到密文文本数据。
在本实施例中由于数据加密需要消耗系统资源,为减少数据加密的系统资源消耗,在对文本数据进行加密之前,可以先判断是否需要对该文本数据进行加密,具体为判断该文本数据中是否存在敏感信息,如果文本数据中存在敏感信息,则对文本数据和对应的键名进行加密,如果该文本数据中不存在敏感信息,则不对该文本数据进行加密。其中,敏感信息包括但不限于客户姓名、证件号码(身份证号码)、出生年月日、联系地址、联系电话、电子邮箱、银行卡号、社交账号和客户联系人信息。
此外,需要补充说明的是,在步骤S20之后,还包括:
步骤b1,在所述文本数据中不包含敏感信息时,判断所述文本数据中是否包含预设标签;
步骤b2,在所述文本数据中包含预设标签时,将所述文本数据按第二预设加密算法进行加密处理,得到密文文本数据;
步骤b3,将所述密文键名与所述密文文本数据关联存储在所述终端的本地存储器。
即,终端确定文本数据中不包含敏感信息时,终端判断文本数据中是否包含预设标签;其中,预设标签是指预先设置的特征标签,在文本数据中包含预设标签时,将文本数据按第二预设加密算法进行加密处理,得到密文文本数据;将密文键名与密文文本数据关联存储在终端的本地存储器中,本实施例中将特殊页面设置预设标签,终端可以对该页面的文本数据进行加密,以防止出现仅根据文本数据的内容判断是否加密出现遗漏的情况。
步骤S40,将所述密文键名与所述密文文本数据关联存储在所述终端的本地存储器。
终端将加密完成的密文键名与密文文本数据关联存储在终端的本地存储器;本实施例中终端将键名进行加密形成密文键名,将文本数据进行加密形成密文文本数据,在本地存储器中数据读取的环节,获取到的是密文键名,需要对密文键名进行解密,才可以获取到对应的键名,然后,终端获取键名对应的密文文本数据,需要对密文文本数据进行解密才可以得到对应的文本数据,有效地降低了本地存储器中存储的文本数据被泄露、盗取的风险,提高了本地存储中数据的安全性。
进一步地,参照图3,在本申请第一实施例的基础上,提出了本申请数据存储方法的第二实施例。
本实施例是第一实施例中步骤S30的细化,具体地,所述数据存储方法包括:
步骤S31,在所述文本数据中包含敏感信息时,判断所述文本数据的字节数是否超过预设字节数。
在终端确定文本数据中包含敏感信息时,终端获取文本数据,计算文本数据对应的字节数,并判断文本数据的字节数是否超过预设字节数,其中,预设字节数可以根据应用场景灵活设置。在文本数据的字节数不超过预设字节数时,终端直接对文本数据进行全部的加密处理。
步骤S32,在所述文本数据的字节数超过预设字节数时,提取所述文本数据中的敏感信息,并建立所述敏感信息与其所占位置之间的映射关系表。
在终端确定文本数据的字节数超过预设字节数时,终端直接对整个文本数据进行加密,需要进行加密处理的数据量较大,此时,终端从文本数据中提取敏感信息,并确定该敏感信息在该文本数据中的占据位置,终端建立敏感信息与占据位置之间的映射关系表,然后将文本数据中的敏感信息删除,并标记敏感信息在该文本数据中的占据位置,得到脱敏文本数据。
步骤S33,将提取的所述敏感信息和所述映射关系表按第二预设加密算法进行加密处理,得到密文敏感信息。
终端将提取的敏感信息和所射关系表按第二预设加密算法进行加密处理,得到密文敏感信息,其中,第二预设加密算法与第一实施例中的相同,本实施例中不作赘述。
进一步地,在终端对文本数据中的敏感信息加密处理完成之后,终端需要进行关联存储,具体地,包括:
步骤S41,将不包含敏感信息的文本数据作为脱敏文本数据,将所述脱敏文本数据和所述密文敏感信息封装为数据包,并将所述数据包与所述密文键名关联存储在所述终端的本地存储器。
终端将不包含敏感信息的文本数据作为脱敏文本数据,终端将脱敏文本数据和密文敏感信息封装为数据包,并将数据包与密文键名关联存储在所述终端的本地存储器。
在本实施例中为了进一步地减少数据加密的系统资源消耗,在确定文本数据中存在敏感信息之后,终端计算该文本数据的字节数,并判断该字节数是否大于预设字节数,在字节数大于预设字节数,终端从文本数据中提取敏感信息,得到脱敏文本数据,并确定该敏感信息在该文本数据中的占据位置,且建立敏感信息与占据位置之间的映射关系表,然后终端通过第二预设算法对提取到的敏感信息和该映射关系表进行加密,得到密文敏感信息,且将该密文敏感信息和脱敏文本数据组合为一个数据包;在得到该数据包之后,终端将该密文键名与该数据包关联存储在本地。
进一步地,在本申请第二实施例的基础上,提出了本申请数据存储方法的第三实施例。
本实施例是第二实施例之后的步骤,本实施例中所述数据存储方法包括:
步骤S50,在接收到文本读取指令时,获取所述文本读取指令对应的身份验证信息和密文键名。
用户在终端上基于浏览器触发网页加载指令时,终端获取网页加载指令对应的页面标识,终端判断本地存储器中是否包含该页面标识对应的文本数据,在终端确定本地存储器中包含该页面标识对应的文本数据,终端接收到文本读取指令,终端获取文本读取指令对应的身份验证信息和密文键名,其中,身份验证信息是指预先设置的用户账户信息,或者用户生物特征信息等等,终端可以基于身份验证信息进行用户身份验证。
步骤S60,在所述身份验证信息验证通过时,获取所述密文键名对应的第一预设解密算法,并基于所述第一预设解密算法解密所述密文键名,得到键名。
在终端确定身份验证信息验证通过时,终端获取密文键名,及密文键名对应的第一预设加密算法,终端获取该第一预设加密算法对应的第一预设解密算法,并通过第一预设解密算法解密该密文键名,得到键名。
步骤S70,获取所述键名对应的数据包,从所述数据包中提取密文敏感信息和脱敏文本数据;获取所述密文敏感信息对应的第二预设解密算法,按所述第二预设解密算法解密所述密文敏感信息,得到敏感信息和敏感映射关系表。
终端获取本地存储器中键名对应的数据包,并从数据包中提取密文敏感信息和脱敏文本数据;然后,终端获取密文敏感信息,及密文敏感信息对应的第二预设加密算法,终端获取第二预设加密算法对应的第二预设解密算法,并按第二预设解密算法解密密文敏感信息,得到密文敏感信息中包含的敏感信息和敏感映射关系表。
步骤S80,将所述敏感信息按所述映射关系表填充到所述脱敏文本数据中,得到所述读取指令对应的文本数据。
终端将敏感信息按映射关系表填充到脱敏文本数据中,得到读取指令对应的文本数据。在本实施例中终端将解密后的脱敏文本数据和敏感信息进行合并,方便了文本数据的查看。
进一步地,在本申请上述实施例的基础上,提出了本申请数据存储方法的第四实施例。
本实施例是第一实施例中步骤S30之后的步骤,所述数据存储方法包括:
步骤S90,当检测到所述本地存储器的可用存储容量低于预设存储阈值时,获取所述本地存储器中各文本数据的属性。
终端实时地监测本地存储器中的可用存储空间,在终端当检测到本地存储器的可用存储容量低于预设存储阈值时,其中,预设存储阈值是指预先设置的存储阈值,例如,预设存储阈值设置为10M,终端获取本地存储器中各文本数据的属性,其中,属性包括但不仅限于创建时间、访问时间、修改时间和所占空间。
步骤S100,按各文本数据的创建时间、访问时间和修改时间,确定待删除的目标文本数据,并删除所述本地存储器中的所述目标文本数据。
终端按各文本数据的创建时间、访问时间和修改时间,确定待删除的目标文本数据,即,终端将创建时间最先、访问时间最先、修改时间最先或者占用空间最大的文本数据作为目标文本数据,并删除本地存储器中的所述目标文本数据。本实施例中通过删除本地存储空间的目标文本数据,进行本地存储空间中文本数据的更新。
此外,参照图4,本申请实施例还提出一种数据存储装置,所述数据存储装置包括:
获取分配模块10,用于获取待存储的文本数据,为所述文本数据分配键名;
键名加密模块20,用于将所述键名按第一预设加密算法进行加密处理,得到密文键名;
文本加密模块30,用于在所述文本数据中包含敏感信息时,将所述文本数据按第二预设加密算法进行加密处理,得到密文文本数据;
关联存储模块40,用于将所述密文键名与所述密文文本数据关联存储在所述终端的本地存储器。
可选地,所述第一预设加密算法包括MD5消息摘要算法;所述键名加密模块20,包括:
键名添加单元,用于在所述键名后拼接偏移量字符串,得到符合预设条件的拼接键名;
第一加密单元,用于将所述拼接键名按所述MD5消息摘要算法转换为预设位数的散列值,得到密文键名。
可选地,所述文本加密模块30,包括:
字节判断单元,用于在所述文本数据中包含敏感信息时,判断所述文本数据的字节数是否超过预设字节数;
提取映射单元,用于在所述文本数据的字节数超过预设字节数时,提取所述文本数据中的敏感信息,并建立所述敏感信息与其所占位置之间的映射关系表;
第二加密单元,用于将提取的所述敏感信息和所述映射关系表按第二预设加密算法进行加密处理,得到密文敏感信息;
所述关联存储模块40,用于将不包含敏感信息的文本数据作为脱敏文本数据,将所述脱敏文本数据和所述密文敏感信息封装为数据包,并将所述数据包与所述密文键名关联存储在所述终端的本地存储器。
可选地,所述的数据存储装置,包括:
指令接收模块,用于在接收到文本读取指令时,获取所述文本读取指令对应的身份验证信息和密文键名;
第一解密模块,用于在所述身份验证信息验证通过时,获取所述密文键名对应的第一预设解密算法,并基于所述第一预设解密算法解密所述密文键名,得到键名;
信息提取模块,用于获取所述键名对应的数据包,从所述数据包中提取密文敏感信息和脱敏文本数据;
第二解密模块,用于获取所述密文敏感信息对应的第二预设解密算法,按所述第二预设解密算法解密所述密文敏感信息,得到敏感信息和敏感映射关系表;
信息填充模块,用于将所述敏感信息按所述映射关系表填充到所述脱敏文本数据中,得到所述读取指令对应的文本数据。
可选地,所述的数据存储装置,包括:
信息接收模块,用于接收基于所述文本数据输入的编辑信息,将所述文本数据,及所述文本数据对应的编辑信息作为新的文本数据;
更新保存模块,用于将新的文本数据保存到在所述终端的本地存储器。
可选地,所述的数据存储装置,包括:
标签判断模块,用于在所述文本数据中不包含敏感信息时,判断所述文本数据中是否包含预设标签;
第二加密模块,用于在所述文本数据中包含预设标签时,将所述文本数据按第二预设加密算法进行加密处理,得到密文文本数据;
关联存储模块,用于将所述密文键名与所述密文文本数据关联存储在所述终端的本地存储器。
可选地,所述的数据存储装置,包括:
检测获取模块,用于当检测到所述本地存储器的可用存储容量低于预设存储阈值时,获取所述本地存储器中各文本数据的属性,其中,所述属性包括创建时间、访问时间和修改时间;
确定删除模块,用于按各文本数据的创建时间、访问时间和修改时间,确定待删除的目标文本数据,并删除所述本地存储器中的所述目标文本数据。
其中,数据存储装置的各个功能模块实现的步骤可参照本申请数据存储方法的各个实施例,此处不再赘述。
此外,本申请实施例还提出一种计算机存储介质,该计算机存储介质可以为非易失性计算机可读存储介质。
所述计算机存储介质上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现上述实施例提供的数据存储方法中的操作。
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体/操作/对象与另一个实体/操作/对象区分开来,而不一定要求或者暗示这些实体/操作/对象之间存在任何这种实际的关系或者顺序;术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者系统中还存在另外的相同要素。
对于装置实施例而言,由于其基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中作为分离部件说明的单元可以是或者也可以不是物理上分开的。可以根据实际的需要选择中的部分或者全部模块来实现本申请方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种数据存储方法,其中,所述数据存储方法包括以下步骤:
    终端获取待存储的文本数据,为所述文本数据分配键名;
    将所述键名按第一预设加密算法进行加密处理,得到密文键名;
    在所述文本数据中包含敏感信息时,将所述文本数据按第二预设加密算法进行加密处理,得到密文文本数据;
    将所述密文键名与所述密文文本数据关联存储在所述终端的本地存储器。
  2. 如权利要求1所述的数据存储方法,其中,所述第一预设加密算法包括MD5消息摘要算法;
    所述将所述键名按第一预设加密算法进行加密处理,得到密文键名的步骤,包括:
    在所述键名后拼接偏移量字符串,得到符合预设条件的拼接键名;
    将所述拼接键名按所述MD5消息摘要算法转换为预设位数的散列值,得到密文键名。
  3. 如权利要求1所述的数据存储方法,其中,所述在所述文本数据中包含敏感信息时,将所述文本数据按第二预设加密算法进行加密处理,得到密文文本数据的步骤,包括:
    在所述文本数据中包含敏感信息时,判断所述文本数据的字节数是否超过预设字节数;
    在所述文本数据的字节数超过预设字节数时,提取所述文本数据中的敏感信息,并建立所述敏感信息与其所占位置之间的映射关系表;
    将提取的所述敏感信息和所述映射关系表按第二预设加密算法进行加密处理,得到密文敏感信息;
    所述将所述密文键名与所述密文文本数据关联存储在所述终端的本地存储器的步骤,包括:
    将不包含敏感信息的文本数据作为脱敏文本数据,将所述脱敏文本数据和所述密文敏感信息封装为数据包,并将所述数据包与所述密文键名关联存储在所述终端的本地存储器。
  4. 如权利要求3所述的数据存储方法,其中,所述将所述密文键名与所述密文文本数据关联存储在所述终端的本地存储器的步骤之后,包括:
    在接收到文本读取指令时,获取所述文本读取指令对应的身份验证信息和密文键名;
    在所述身份验证信息验证通过时,获取所述密文键名对应的第一预设解密算法,并基于所述第一预设解密算法解密所述密文键名,得到键名;
    获取所述键名对应的数据包,从所述数据包中提取密文敏感信息和脱敏文本数据;
    获取所述密文敏感信息对应的第二预设解密算法,按所述第二预设解密算法解密所述密文敏感信息,得到敏感信息和敏感映射关系表;
    将所述敏感信息按所述映射关系表填充到所述脱敏文本数据中,得到所述读取指令对应的文本数据。
  5. 如权利要求4所述的数据存储方法,其中,所述将所述敏感信息按所述映射关系表填充到所述脱敏文本数据中,得到所述读取指令对应的文本数据的步骤之后,包括:
    接收基于所述文本数据输入的编辑信息,将所述文本数据,及所述文本数据对应的编辑信息作为新的文本数据;
    将新的文本数据保存到在所述终端的本地存储器。
  6. 如权利要求1所述的数据存储方法,其中,所述将所述键名按第一预设加密算法进行加密处理,得到密文键名的步骤之后,包括:
    在所述文本数据中不包含敏感信息时,判断所述文本数据中是否包含预设标签;
    在所述文本数据中包含预设标签时,将所述文本数据按第二预设加密算法进行加密处理,得到密文文本数据;
    将所述密文键名与所述密文文本数据关联存储在所述终端的本地存储器。
  7. 如权利要求1所述的数据存储方法,其中,所述将所述密文键名与所述密文文本数据关联存储在所述终端的本地存储器的步骤之后,包括:
    当检测到所述本地存储器的可用存储容量低于预设存储阈值时,获取所述本地存储器中各文本数据的属性,其中,所述属性包括创建时间、访问时间和修改时间;
    按各文本数据的创建时间、访问时间和修改时间,确定待删除的目标文本数据,并删除所述本地存储器中的所述目标文本数据。
  8. 一种数据存储装置,其中,所述数据存储装置包括:
    获取分配模块,用于获取待存储的文本数据,为所述文本数据分配键名;
    键名加密模块,用于将所述键名按第一预设加密算法进行加密处理,得到密文键名;
    文本加密模块,用于在所述文本数据中包含敏感信息时,将所述文本数据按第二预设加密算法进行加密处理,得到密文文本数据;
    关联存储模块,用于将所述密文键名与所述密文文本数据关联存储在所述终端的本地存储器。
  9. 如权利要求8所述的数据存储装置,其中,所述第一预设加密算法包括MD5消息摘要算法,所述键名加密模块包括:
    键名添加单元,用于在所述键名后拼接偏移量字符串,得到符合预设条件的拼接键名;
    第一加密单元,用于将所述拼接键名按所述MD5消息摘要算法转换为预设位数的散列值,得到密文键名。
  10. 如权利要求8所述的数据存储装置,其中,所述文本加密模块包括:
    字节判断单元,用于在所述文本数据中包含敏感信息时,判断所述文本数据的字节数是否超过预设字节数;
    提取映射单元,用于在所述文本数据的字节数超过预设字节数时,提取所述文本数据中的敏感信息,并建立所述敏感信息与其所占位置之间的映射关系表;
    第二加密单元,用于将提取的所述敏感信息和所述映射关系表按第二预设加密算法进行加密处理,得到密文敏感信息;
  11. 如权利要求8所述的数据存储装置,其中,所述的数据存储装置包括:
    信息接收模块,用于接收基于所述文本数据输入的编辑信息,将所述文本数据,及所述文本数据对应的编辑信息作为新的文本数据;
    更新保存模块,用于将新的文本数据保存到在所述终端的本地存储器。
  12. 如权利要求8所述的数据存储装置,其中,所述的数据存储装置包括:
    标签判断模块,用于在所述文本数据中不包含敏感信息时,判断所述文本数据中是否包含预设标签;
    第二加密模块,用于在所述文本数据中包含预设标签时,将所述文本数据按第二预设加密算法进行加密处理,得到密文文本数据;
    关联存储模块,用于将所述密文键名与所述密文文本数据关联存储在所述终端的本地存储器。
  13. 一种数据存储设备,其中,所述数据存储设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机可读指令,其中,所述计算机可读指令被所述处理器执行时实现如下步骤:
    终端获取待存储的文本数据,为所述文本数据分配键名;
    将所述键名按第一预设加密算法进行加密处理,得到密文键名;
    在所述文本数据中包含敏感信息时,将所述文本数据按第二预设加密算法进行加密处理,得到密文文本数据;
    将所述密文键名与所述密文文本数据关联存储在所述终端的本地存储器。
  14. 如权利要求13所述的数据存储设备,其中,所述第一预设加密算法包括MD5消息摘要算法;
    所述将所述键名按第一预设加密算法进行加密处理,得到密文键名的步骤,包括:
    在所述键名后拼接偏移量字符串,得到符合预设条件的拼接键名;
    将所述拼接键名按所述MD5消息摘要算法转换为预设位数的散列值,得到密文键名。
  15. 如权利要求13所述的数据存储设备,其中,所述在所述文本数据中包含敏感信息时,将所述文本数据按第二预设加密算法进行加密处理,得到密文文本数据的步骤,包括:
    在所述文本数据中包含敏感信息时,判断所述文本数据的字节数是否超过预设字节数;
    在所述文本数据的字节数超过预设字节数时,提取所述文本数据中的敏感信息,并建立所述敏感信息与其所占位置之间的映射关系表;
    将提取的所述敏感信息和所述映射关系表按第二预设加密算法进行加密处理,得到密文敏感信息;
    所述将所述密文键名与所述密文文本数据关联存储在所述终端的本地存储器的步骤,包括:
    将不包含敏感信息的文本数据作为脱敏文本数据,将所述脱敏文本数据和所述密文敏感信息封装为数据包,并将所述数据包与所述密文键名关联存储在所述终端的本地存储器。
  16. 如权利要求15所述的数据存储设备,其中,所述将所述密文键名与所述密文文本数据关联存储在所述终端的本地存储器的步骤之后,包括:
    在接收到文本读取指令时,获取所述文本读取指令对应的身份验证信息和密文键名;
    在所述身份验证信息验证通过时,获取所述密文键名对应的第一预设解密算法,并基于所述第一预设解密算法解密所述密文键名,得到键名;
    获取所述键名对应的数据包,从所述数据包中提取密文敏感信息和脱敏文本数据;
    获取所述密文敏感信息对应的第二预设解密算法,按所述第二预设解密算法解密所述密文敏感信息,得到敏感信息和敏感映射关系表;
    将所述敏感信息按所述映射关系表填充到所述脱敏文本数据中,得到所述读取指令对应的文本数据。
  17. 一种计算机存储介质,其中,所述计算机存储介质上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现如下步骤:
    终端获取待存储的文本数据,为所述文本数据分配键名;
    将所述键名按第一预设加密算法进行加密处理,得到密文键名;
    在所述文本数据中包含敏感信息时,将所述文本数据按第二预设加密算法进行加密处理,得到密文文本数据;
    将所述密文键名与所述密文文本数据关联存储在所述终端的本地存储器。
  18. 如权利要求17所述的计算机存储介质,其中,所述第一预设加密算法包括MD5消息摘要算法;
    所述将所述键名按第一预设加密算法进行加密处理,得到密文键名的步骤,包括:
    在所述键名后拼接偏移量字符串,得到符合预设条件的拼接键名;
    将所述拼接键名按所述MD5消息摘要算法转换为预设位数的散列值,得到密文键名。
  19. 如权利要求17所述的计算机存储介质,其中,所述在所述文本数据中包含敏感信息时,将所述文本数据按第二预设加密算法进行加密处理,得到密文文本数据的步骤,包括:
    在所述文本数据中包含敏感信息时,判断所述文本数据的字节数是否超过预设字节数;
    在所述文本数据的字节数超过预设字节数时,提取所述文本数据中的敏感信息,并建立所述敏感信息与其所占位置之间的映射关系表;
    将提取的所述敏感信息和所述映射关系表按第二预设加密算法进行加密处理,得到密文敏感信息;
    所述将所述密文键名与所述密文文本数据关联存储在所述终端的本地存储器的步骤,包括:
    将不包含敏感信息的文本数据作为脱敏文本数据,将所述脱敏文本数据和所述密文敏感信息封装为数据包,并将所述数据包与所述密文键名关联存储在所述终端的本地存储器。
  20. 如权利要求19所述的计算机存储介质,其中,所述将所述密文键名与所述密文文本数据关联存储在所述终端的本地存储器的步骤之后,包括:
    在接收到文本读取指令时,获取所述文本读取指令对应的身份验证信息和密文键名;
    在所述身份验证信息验证通过时,获取所述密文键名对应的第一预设解密算法,并基于所述第一预设解密算法解密所述密文键名,得到键名;
    获取所述键名对应的数据包,从所述数据包中提取密文敏感信息和脱敏文本数据;
    获取所述密文敏感信息对应的第二预设解密算法,按所述第二预设解密算法解密所述密文敏感信息,得到敏感信息和敏感映射关系表;
    将所述敏感信息按所述映射关系表填充到所述脱敏文本数据中,得到所述读取指令对应的文本数据。
PCT/CN2019/117198 2019-08-14 2019-11-11 数据存储方法、装置、设备和计算机存储介质 WO2021027134A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910761802.7A CN110502602B (zh) 2019-08-14 2019-08-14 数据存储方法、装置、设备和计算机存储介质
CN201910761802.7 2019-08-14

Publications (1)

Publication Number Publication Date
WO2021027134A1 true WO2021027134A1 (zh) 2021-02-18

Family

ID=68588220

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/117198 WO2021027134A1 (zh) 2019-08-14 2019-11-11 数据存储方法、装置、设备和计算机存储介质

Country Status (2)

Country Link
CN (1) CN110502602B (zh)
WO (1) WO2021027134A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113742340A (zh) * 2021-08-17 2021-12-03 深圳Tcl新技术有限公司 一种数据库表处理方法及相关设备

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111814166B (zh) * 2020-07-10 2023-09-12 上海淇毓信息科技有限公司 一种数据加密方法、装置和电子设备
CN111859435B (zh) * 2020-07-29 2023-06-23 北京千丁互联科技有限公司 一种数据安全处理方法及装置
CN112084523A (zh) * 2020-09-29 2020-12-15 深圳壹账通智能科技有限公司 文本加密方法及装置、终端设备、存储介质
CN115048682B (zh) * 2022-08-15 2022-11-01 河北省农林科学院农业信息与经济研究所 一种土地流转信息的安全存储方法

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105468990A (zh) * 2014-09-04 2016-04-06 中国移动通信集团安徽有限公司 一种敏感信息的管理控制方法和装置
CN105993010A (zh) * 2014-02-11 2016-10-05 德州仪器公司 用以提供扩展对象符号数据的方法及设备
US20170288858A1 (en) * 2014-10-21 2017-10-05 Mitsubishi Electric Corporation Server apparatus, search system, terminal apparatus, search method, non-transitory computer readable medium storing server program, and non-transitory computer readable medium storing terminal program
CN108629196A (zh) * 2017-03-21 2018-10-09 北京京东尚科信息技术有限公司 数据存储和查询的方法、装置、电子设备和可读存储介质

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5889177B2 (ja) * 2012-12-25 2016-03-22 株式会社日立製作所 データベースシステム及びその更新方法
US9602280B2 (en) * 2013-03-13 2017-03-21 Futurewei Technologies, Inc. System and method for content encryption in a key/value store
CN106295403A (zh) * 2016-10-11 2017-01-04 北京集奥聚合科技有限公司 一种基于hbase的数据安全处理方法及系统
CN106997439B (zh) * 2017-04-01 2020-06-19 北京元心科技有限公司 基于TrustZone的数据加解密方法、装置及终端设备
CN109598137B (zh) * 2017-09-30 2021-08-13 广东亿迅科技有限公司 一种用于安全处理数据的方法及其系统
CN109711178B (zh) * 2018-12-18 2021-02-19 北京城市网邻信息技术有限公司 一种键值对的存储方法、装置、设备及存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105993010A (zh) * 2014-02-11 2016-10-05 德州仪器公司 用以提供扩展对象符号数据的方法及设备
CN105468990A (zh) * 2014-09-04 2016-04-06 中国移动通信集团安徽有限公司 一种敏感信息的管理控制方法和装置
US20170288858A1 (en) * 2014-10-21 2017-10-05 Mitsubishi Electric Corporation Server apparatus, search system, terminal apparatus, search method, non-transitory computer readable medium storing server program, and non-transitory computer readable medium storing terminal program
CN108629196A (zh) * 2017-03-21 2018-10-09 北京京东尚科信息技术有限公司 数据存储和查询的方法、装置、电子设备和可读存储介质

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
SONG ZHIYI; MA ZHAOFENG; HUANG QINLONG: "Research and Implementation of Data Encryption Technology for MongoDB Based on Order-Preserving Encryption", PROCEEDINGS OF THE 10TH ANNUAL CONFERENCE OF CHINA INSTITUTE OF COMMUNICATIONS, 5 September 2014 (2014-09-05), pages 279 - 285, XP009526027 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113742340A (zh) * 2021-08-17 2021-12-03 深圳Tcl新技术有限公司 一种数据库表处理方法及相关设备

Also Published As

Publication number Publication date
CN110502602A (zh) 2019-11-26
CN110502602B (zh) 2023-10-17

Similar Documents

Publication Publication Date Title
WO2021027134A1 (zh) 数据存储方法、装置、设备和计算机存储介质
WO2020224246A1 (zh) 基于区块链的数据管理方法、装置、设备和存储介质
WO2020029585A1 (zh) 基于迁移学习的神经网络联邦建模方法、设备及存储介质
WO2019024126A1 (zh) 基于区块链的知识管理方法、终端及服务器
WO2019144738A1 (zh) 金融业务的验证方法、装置、设备和计算机存储介质
WO2016137304A1 (en) Trust-zone-based end-to-end security
WO2014171797A1 (ko) 파일 보안 방법 및 이를 위한 장치
WO2017122980A1 (en) Electronic device and method for authenticating identification information thereof
WO2016169410A1 (zh) 登录方法、服务器和登录系统
WO2016137185A1 (en) Electronic device and method for providing drm content by the electronic device
WO2013149548A1 (zh) 一种手机数据加密方法以及解密方法
WO2020231177A1 (en) Electronic device and method for receiving push message stored in blockchain
WO2021072881A1 (zh) 基于对象存储的请求处理方法、装置、设备及存储介质
WO2018076879A1 (zh) 数据备份方法、装置、存储介质及终端
EP3850521A1 (en) Electronic apparatus managing data based on block chain and method for managing data
WO2020062661A1 (zh) 合同数据一致性的核实方法、装置、设备及存储介质
WO2020155772A1 (zh) 验证图片发送方法、合成方法及装置、存储介质和终端
WO2018079999A1 (en) Electronic device and method for operating the same
WO2016200058A1 (ko) 바이너리 병합 장치, 방법 및 컴퓨터 프로그램
WO2018032583A1 (zh) 一种终端位置信息获取方法及装置
WO2020096262A1 (ko) 전자 장치, 그의 개인 정보 제공 방법 및 이를 기록한 컴퓨터 판독 가능 기록매체
WO2022010136A1 (ko) 클라우드 서버 및 이의 제어 방법
WO2020235858A1 (en) Server and control method thereof
WO2020242062A1 (ko) 멀티캐스트 그룹 내의 구독자에게 키 데이터를 전송하는 디바이스
WO2020149555A1 (ko) 암호화될 데이터의 정보량에 기반하여 암호화에 사용될 키를 선택하는 전자 장치 및 전자 장치의 동작 방법

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19941094

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19941094

Country of ref document: EP

Kind code of ref document: A1