Encrypted data updating method, electronic equipment, storage medium and computer program
By regularly updating the key and reencrypting the data, the leakage risk of sensitive data storage in the financial industry in the technical service provider system is solved, the security of data storage is improved, and the data is not easily decrypted after being leaked. The processing and verification mechanism ensures data integrity.
Patent Information
- Application Number
- CN202410922085.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2024-11-22
AI Technical Summary
In the financial industry, when merchants’ sensitive data is stored in the system of technical service providers, there is a risk of data leakage, and existing encryption methods are difficult to effectively reduce such risks.
By regularly updating the key and using the updated key to reencrypt the stored data, we ensure that the encrypted data of the same plain text data is inconsistent in different update cycles, thereby improving the security of the data.
It effectively improves the security of data storage in other places, prevents the leaked data from being correctly decrypted, reduces the risks brought by data leakage, and further ensures the integrity of the data through hashing and verification mechanisms.
Smart Images

Figure CN119004495A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data encryption technology, and in particular to an encrypted data updating method, electronic device, storage medium and computer program. Background Art
[0002] In the financial industry, when technology service providers provide products and services to merchants, they provide a full set of closed-loop products and services for merchants to use. Therefore, the merchant's data is stored within the technology service provider, and the merchant cannot control its own data stored in the technology service provider.
[0003] Although encrypted storage can reduce the risk of data leakage to a certain extent, since the data is stored in technical service providers, there is still a risk of leakage for some sensitive data. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide an encrypted data update method, electronic device, storage medium and computer program, which are used to periodically update the key and re-encrypt the data stored in the data storage party based on the updated key, thereby improving the security of data storage in a different location.
[0005] In the first aspect, an embodiment of the present application provides an encrypted data updating method, which is applied to a data storage party, and the method includes: receiving a first key sent by a key management party; the first key is generated by the key management party according to a preset update cycle; obtaining a field to be updated, and querying a database based on the field to be updated to obtain the original encrypted data corresponding to the field to be updated; using a second key to decrypt the original encrypted data to obtain first plaintext data; the second key is a key received before receiving the first key; and re-encrypting the first plaintext data using the first key to obtain updated encrypted data.
[0006] In the embodiment of the present application, the key management party regularly updates the key and sends the updated key to the data storage party, so that the data storage party re-encrypts the plaintext data with the new key. In this process, since the key is updated regularly, the encrypted data corresponding to the same plaintext data in different update cycles is different. Even if the encrypted data is leaked in the previous update cycle, it will not be correctly decrypted due to the key change. Therefore, the security of data storage in different places is improved.
[0007] In some embodiments, after obtaining the first plaintext data, the method also includes: segmenting the first plaintext data according to a preset number; performing hash processing on the data of each segment to generate features of each segment; obtaining a total feature of the field to be updated based on the features of each segment; and sending the total feature to the key manager so that the key manager verifies the first plaintext data based on the total feature.
[0008] After obtaining the first plaintext data, the embodiment of the present application generates a total feature of the first plaintext data and sends it to the key management party, so that the key management party verifies the first plaintext data through the total feature to verify whether the first plaintext data has been tampered with, thereby further improving the security of off-site data storage.
[0009] In some embodiments, querying the database based on the field to be updated includes: obtaining the data table name and database name to which the field to be updated belongs; constructing a query statement based on the data table name and the field to be updated; and using the query statement to query the database corresponding to the database name.
[0010] The embodiment of the present application constructs a query statement to query the database by using the data table name and database name to which the field to be updated belongs, so as to improve the accuracy of data query.
[0011] In some embodiments, after obtaining the updated encrypted data, the method further includes: obtaining a data identifier corresponding to each piece of data in the field to be updated; based on the data identifier, writing the updated encrypted data to a corresponding position in the database to update the database.
[0012] After obtaining the updated encrypted data, the embodiment of the present application writes the updated encrypted data into the corresponding position of the database through the data identifier to improve the accuracy of data writing.
[0013] In some embodiments, after updating the database, the method further includes: destroying the second key.
[0014] In the embodiment of the present application, after the database is updated, the second key is destroyed, thereby reducing the risk of the original encrypted data being decrypted due to the leakage of the second key.
[0015] In some embodiments, the method further includes: receiving a query request from a service initiator; the query request includes a query identifier; querying a database using the query identifier to obtain encrypted data; and issuing an alarm if the first key or the second key cannot decrypt the encrypted data.
[0016] The embodiment of the present application takes into account that in the process of re-encrypting the first plaintext data using the first key, the system where the data storage party is located is still working normally, and at this time, the query request initiated by the service initiator will still be received normally. When the query is completed and the key is used for decryption, if neither the first key nor the second key can decrypt the encrypted data of the query normally, it indicates that there is a risk of tampering with the queried data, or the risk of data in the database being leaked. At this time, an alarm prompt is issued to prompt the staff to handle it in time to reduce the risk caused by data leakage.
[0017] In some embodiments, the method further includes: decrypting the encrypted data using the first key or the second key; if second plaintext data is obtained, obfuscating the second plaintext data to obtain obfuscated data; and returning the obfuscated data to the service initiator.
[0018] The embodiment of the present application takes into account the risk of leakage of decrypted data during transmission. Therefore, the decrypted data is obfuscated before being returned to the service initiator, thereby improving the security of the data during transmission, thereby improving the security of data storage in a different location.
[0019] In some embodiments, the query request includes an execution script; the method also includes: decrypting the encrypted data using the first key or the second key; if third plaintext data is obtained, calculating the third plaintext data according to the execution script to obtain result data; and returning the result data to the business initiator.
[0020] In the embodiment of the present application, when it is necessary to use the decrypted data for calculation, in order to avoid data leakage during transmission and to improve the security of the data calculation process, the execution script for performing the calculation is sent to the data storage party at this time, so that the data storage party only returns one result when returning the data. Even if the result is leaked, it is not clear which data is involved in the calculation. Therefore, the security of data storage in a different location is improved.
[0021] In the second aspect, an embodiment of the present application provides an encrypted data updating device, which includes: a receiving module, used to receive a first key sent by a key management party; the first key is generated by the key management party according to a preset update cycle; a query module, used to obtain a field to be updated, and query the database based on the field to be updated to obtain the original encrypted data corresponding to the field to be updated; a decryption module, used to decrypt the original encrypted data using a second key to obtain first plaintext data; the second key is a key received before receiving the first key; an encryption module, used to re-encrypt the plaintext data using the first key to obtain updated encrypted data.
[0022] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, a storage medium and a bus, wherein the processor and the memory communicate with each other through the bus; the memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute the method steps of the first aspect.
[0023] In a fourth aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium, comprising: the computer-readable storage medium stores computer instructions, and the computer instructions enable the computer to execute the method steps of the first aspect.
[0024] In a fifth aspect, an embodiment of the present application provides a computer program product, including: a computer program, which executes the method steps of the first aspect when executed by a processor.
[0025] Other features and advantages of the present application will be described in the subsequent description, and in part will become apparent from the description, or will be understood by implementing the embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0027] Figure 1 A flowchart of a method for updating encrypted data provided in an embodiment of the present application;
[0028] Figure 2 A schematic diagram of the structure of an encrypted data updating device provided in an embodiment of the present application;
[0029] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] The following embodiments of the technical solution of the present application are described in detail in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present application, and are therefore only used as examples, and cannot be used to limit the scope of protection of the present application.
[0031] It should be noted that all technical and scientific terms used in this document have the same meanings as those generally understood by technicians in the technical field to which this application belongs; the terms used in this document are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" in the specification and claims of this application and the above-mentioned figure descriptions and any variations thereof are intended to cover non-exclusive inclusions.
[0032] In the description of the embodiments of the present application, the technical terms "first", "second", etc. are only used to distinguish different objects, and cannot be understood as indicating or implying relative importance or implicitly indicating the number, specific order or primary and secondary relationship of the indicated technical features. In the description of the embodiments of the present application, the meaning of "multiple" is more than two, unless otherwise clearly and specifically defined.
[0033] Figure 1A flow chart of an encrypted data update method provided in an embodiment of the present application, the method is applied to a data storage party, which may be a terminal device (also referred to as an electronic device) and a server; wherein the terminal device may specifically be a smart phone, a tablet computer, a computer, a personal digital assistant (PDA), etc.; the server may specifically be an application server or a Web server.
[0034] To facilitate understanding of the technical solution provided in the embodiment of the present application, the application scenario of the encrypted data updating method provided in the embodiment of the present application is introduced below by taking the server as the execution subject as an example.
[0035] like Figure 1 As shown, the method includes:
[0036] Step S101, the server receives a first key sent by a key management party; the first key is generated by the key management party according to a preset update cycle.
[0037] Optionally, the key manager may be a merchant who has a need for off-site data storage, where the merchant may be a bank or an enterprise, etc. The key manager may also be a data service provider who is entrusted by the merchant to manage the key.
[0038] The data storage party is the technical service provider that provides technical services to merchants.
[0039] For example, the merchant is Bank A, and the data storage provider is Technology Service Provider B. Technology Service Provider B provides data storage services to Bank A. At this time, Bank A stores the data off-site in the server provided by Technology Service Provider B.
[0040] Since the data of Bank A is stored on the server provided by Technology Service Provider B, Bank A is unable to control the data stored on Technology Service Provider B, which leads to the risk of data leakage of Bank A.
[0041] Therefore, in order to improve the security of data stored in the data storage party, the key management party updates the key at regular intervals and synchronizes the updated key to the data storage party, so that the data storage party re-encrypts the stored data at regular intervals.
[0042] Based on this, the server receives the first key sent by the key management party; wherein the first key is generated by the key management party according to a preset update cycle.
[0043] The preset update cycle is specifically set according to the actual situation. For example, the key manager can manually update the key, that is, the key manager can update the key from time to time. The key manager can also set the automatic update frequency and update the key according to the set automatic update frequency.
[0044] Step S102: The server obtains the field to be updated, and queries the database based on the field to be updated to obtain the original encrypted data corresponding to the field to be updated.
[0045] Optionally, in actual business scenarios, in order to facilitate business execution and rational use of resources, it is not necessary to encrypt all data stored in the database. Therefore, merchants and technical service providers will negotiate in advance which data needs to be encrypted and stored.
[0046] For ease of understanding, data that needs to be encrypted and stored is called sensitive data. For example, data such as ID number, mobile phone number, name, user bank card password, address, etc. are sensitive data. In the database, fields such as ID number, mobile phone number, name, user bank card password, address, etc. are called sensitive fields.
[0047] Because the database stores a large number of data tables, and some fields of different data tables may be the same, in order to clearly know which sensitive field in which table the encrypted data corresponding to is updated, a field mapping table RequiredEncryptField is maintained in both the merchant and the data storage party.
[0048] One of the data in RequiredEncryptField is {"dbName":"db1","tableName":"tb1","fieldName":"f5"}, where "dbName" indicates the database name, "tableName" indicates the data table name, and "fieldName" indicates the field name.
[0049] Therefore, by traversing RequiredEncryptField, the server can know which fields of which data tables in which databases need to re-encrypt data.
[0050] After the server obtains the first key, in order to ensure the consistency of the encrypted data, it is necessary to traverse each data item in the RequiredEncryptField to re-encrypt the data of the fields corresponding to all the field names involved in the RequiredEncryptField.
[0051] The field to be updated is the field corresponding to the field name "fieldName" in RequiredEncryptField.
[0052] After the server obtains the field to be updated, it can query the database based on the field to be updated to obtain the original encrypted data corresponding to the field to be updated. The original encrypted data refers to the data encrypted with the second key. The second key is stored in the memory of the data storage party.
[0053] Step S103, the server decrypts the original encrypted data using the second key to obtain the first plaintext data; the second key is a key received before receiving the first key.
[0054] Step S104: the server re-encrypts the plaintext data using the first key to obtain updated encrypted data.
[0055] Optionally, since the original encrypted data is data encrypted using the second key, the server decrypts the original encrypted data using the second key to obtain corresponding plaintext data.
[0056] It should be noted that the second key is a key received before receiving the first key, that is, a key sent by the key management party and received by the server in an update cycle before the current update cycle.
[0057] Optionally, the server re-encrypts the plaintext data using the first key to obtain updated encrypted data.
[0058] In the embodiment of the present application, the key management party regularly updates the key and sends the updated key to the data storage party, so that the data storage party re-encrypts the plaintext data with the new key. In this process, since the key is updated regularly, the encrypted data corresponding to the same plaintext data in different update cycles is different. Even if the encrypted data is leaked in the previous update cycle, it will not be correctly decrypted due to the key change. Therefore, the security of data storage in different places is improved.
[0059] In some embodiments, after the server obtains the first plaintext data, the method also includes: the server segments the first plaintext data according to a preset number; the server performs hash processing on the data of each segment to generate a feature of each segment; the server obtains a total feature of the field to be updated based on the feature of each segment; the server sends the total feature to the key manager, so that the key manager verifies the first plaintext data based on the total feature.
[0060] Optionally, in addition to re-encrypting the data using a dynamically changing key, taking into account the possibility that the data may be tampered with, after obtaining the first plaintext data, features of the plaintext data are generated so that the key management party can determine whether the data has been tampered with based on the features.
[0061] Among them, tampering includes at least one of modifying data, reducing data, adding data, etc.
[0062] The "preset number" is a preset value, for example, the preset number is 50, 100 or 150, which can be set specifically according to the actual situation. However, it should be noted that if the amount of data in the last segment after segmentation is less than the preset number, the remaining data is directly hashed.
[0063] Exemplarily, the embodiments of the present application are described with the preset number being 100.
[0064] After obtaining the first plaintext data, the server processes the first plaintext data in segments according to every 100 pieces of data.
[0065] The first plaintext data includes 260 data items. After being segmented into 100 data items, the first plaintext data is divided into 3 segments, namely [1-100], [101-200], and [201-260]. Each segment is hashed to obtain the characteristics of each segment. Based on the characteristics of each segment, the total characteristics of the field to be updated are obtained.
[0066] For example: {"db1.tb1.f5":["AJKD**ASD","JHS**SJDK","SHD**SSDJD"]} means that the field f5 to be updated in the data table tb1 in the database db1 has three features "AJKD**ASD", "JHS**SJDK", "SHD**SSDJD", and these three features constitute the total features of the first plaintext data corresponding to f5.
[0067] When doing hash processing, connect each data together to make the hash, for example: td = hash(d1||d2||...||d100).
[0068] For another example: Bank A sets the automatic key update and synchronization at midnight every day. At 5:30 on the same day, technical service provider B sends a request to Bank A for the updated field f5, and synchronizes 580 data items and 6 hashes in the field.
[0069] At 5:31 on the same day, technical service provider B used technical means to obtain the key in the server memory, and modified the original data at the 188th position after ascending sorting, and added 8 new data. In the next update cycle, the second hash and the sixth hash both changed relative to the data synchronized to Bank A at 5:30. The change in the second hash was due to technical service provider B tampering with the data at the 188th position. The change in the sixth hash means that technical service provider B has added new data.
[0070] After obtaining the first plaintext data, the embodiment of the present application generates a total feature of the first plaintext data and sends it to the key management party, so that the key management party verifies the first plaintext data through the total feature to verify whether the first plaintext data has been tampered with, thereby further improving the security of off-site data storage.
[0071] In some embodiments, querying the database based on the field to be updated includes: the server obtains the data table name and database name to which the field to be updated belongs; the server constructs a query statement based on the data table name and the field to be updated; the server uses the query statement to query the database corresponding to the database name.
[0072] Optionally, it can be seen from the above embodiments that after the field to be updated is known, it is necessary to query the encrypted data corresponding to the field to be updated to perform subsequent decryption operations and re-encryption operations.
[0073] When the server performs a query operation, it needs to connect to the corresponding database before it can perform the query. Therefore, the maintenance personnel pre-configure the connection with each database so that it can directly connect to the database when executing the query.
[0074] By traversing RequiredEncryptField, you can get the database name and table name to which the field to be updated belongs. Therefore, the server directly connects to the database corresponding to the database name through the database name and the pre-configured connection, and then builds a query statement based on the table name and the field to be updated, and executes a query on the table corresponding to the table name through the query statement.
[0075] For example, the database name is db1, the data table name is tb1, the field to be updated is f5, and the query statement created is select f5 from tb1. This query statement will query all the data corresponding to the f5 field in the data table tb1. For example: tb1 is a student table, f5 is an ID number, and the ID numbers of all students in the student table are queried by selecting f5 from tb1.
[0076] However, since the queried data needs to be decrypted and re-encrypted, and the data queried by select f5 from tb1 is out of order, and it is not clear to whom the ID number belongs, in addition to querying f5, it is also necessary to query the primary key field of tb1, and to facilitate the subsequent update of the re-encrypted data to the database, an ordered query can be performed. The ordered query can be in ascending or descending order, which is set according to the actual situation.
[0077] At this time, change the query statement to select f1,f5 from tb1 order by f1 ASC, where f1 is the primary key field of tb1, which is used to uniquely identify each data of f5. ASC means ascending order.
[0078] For example, f1 is the student ID number, f5 is the ID number, and the query statement select f1,f5 from tb1 order byf1 ASC means to query all the ID numbers in tb1 in ascending order of the student ID number. The query result is [{f1:”N001”,f5:”NJKH**ADS12A”},{f1:”N002”,f5:”NOIK**ASVH2F”},……{f1:”N00n”,f5:”NHVS**FNJS 1N”}].
[0079] To facilitate data manipulation, the query results can be stored in the data structure retList <Map<String,Object> >, String represents the field name, and Object represents the data corresponding to the field name.
[0080] The embodiment of the present application constructs a query statement to query the database by using the data table name and database name to which the field to be updated belongs, so as to improve the accuracy of data query.
[0081] In some embodiments, after obtaining the updated encrypted data, the method further includes: the server obtains a data identifier corresponding to each piece of data in the field to be updated; based on the data identifier, the server writes the updated encrypted data to a corresponding position in the database to update the database.
[0082] Optionally, after obtaining the updated encrypted data, since the decryption and encryption operations are performed in the memory of the data storage party, the original encrypted data in the database has not been updated at this time. Therefore, in order to ensure the accuracy of the data stored in the database, the updated encrypted data needs to be written into the database to replace the original encrypted data.
[0083] When writing data to a database, it is necessary to know the data table, data field, and location of the data in the data table. From the above embodiments, it can be seen that each data can be uniquely identified by the primary key field of the data table. Therefore, the server obtains the data identifier corresponding to each data in the field to be updated; through the data identifier, the updated encrypted data is written to the corresponding location of the database to update the database.
[0084] The updated encrypted data is written to the corresponding position of the database through an update statement. The update statement is updatetb1 set f5=newEncryptValue where f1=N001, where newEncryptValue represents the updated encrypted data. This update statement indicates that the original encrypted data with the field name f5 corresponding to the data identifier N001 is updated to newEncryptValue.
[0085] After obtaining the updated encrypted data, the embodiment of the present application writes the updated encrypted data into the corresponding position of the database through the data identifier to improve the accuracy of data writing.
[0086] In some embodiments, after updating the database, the method further includes: the server destroying the second key.
[0087] Optionally, since multiple pieces of data are stored in RequiredEncryptField, it is necessary to execute the process of the above embodiment for each piece of data in RequiredEncryptField, so as to update the original encrypted data of all the fields to be updated that need to be updated.
[0088] After the update is completed, since the data corresponding to all the fields to be updated are re-encrypted with the first key, the second key is destroyed at this time to ensure the uniqueness of the key when the next update cycle is reached.
[0089] In the embodiment of the present application, after the database is updated, the second key is destroyed, thereby reducing the risk of the original encrypted data being decrypted due to the leakage of the second key.
[0090] In some embodiments, the method also includes: the server receives a query request from a business initiator; the query request includes a query identifier; the server uses the query identifier to query the database to obtain encrypted data; if the first key or the second key cannot decrypt the encrypted data, an alarm is issued.
[0091] Optionally, considering that during the process of re-encrypting the first plaintext data with the first key, the system where the data storage party is located is still operating normally, the query request initiated by the service initiator will still be received normally at this time.
[0092] However, since the updating process of the encrypted data has not yet been completed, at this time, the first key and the second key are stored in the memory of the data storage party.
[0093] The query request sent by the service initiator includes a query identifier to accurately query the target data through the query identifier. Since the data is encrypted and stored in the database, the query result is encrypted data, and the encrypted data needs to be decrypted using the first key and the second key.
[0094] If the decryption is successful using the first key or the second key, the decrypted data is returned to the service initiator.
[0095] If the decryption using the first key or the second key fails, an alarm will be issued to prompt the staff to handle it in time to reduce the risk of data leakage.
[0096] The embodiment of the present application takes into account that in the process of re-encrypting the first plaintext data using the first key, the system where the data storage party is located is still working normally, and at this time, the query request initiated by the service initiator will still be received normally. When the query is completed and the key is used for decryption, if neither the first key nor the second key can decrypt the encrypted data of the query normally, it indicates that there is a risk of tampering with the queried data, or the risk of data in the database being leaked. At this time, an alarm prompt is issued to prompt the staff to handle it in time to reduce the risk caused by data leakage.
[0097] In some embodiments, the method further includes: the server decrypts the encrypted data using the first key or the second key; if second plaintext data is obtained, the server obfuscates the second plaintext data to obtain obfuscated data; and the server returns the obfuscated data to the service initiator.
[0098] Optionally, in actual business scenarios, some data is directly returned to the business initiator for display after being queried. However, since there is a risk of data leakage during network transmission, in order to reduce such risks, after successfully decrypting the encrypted data obtained by the queried data using the first key or the second key, the decrypted second plaintext data is obfuscated and the obfuscated data is returned to the business initiator.
[0099] In order to ensure the accuracy of the data displayed to the user, it is necessary to set an anti-obfuscation algorithm in the front-end system of the business initiator to process the obfuscated data into correct data for display.
[0100] The embodiment of the present application takes into account the risk of leakage of decrypted data during transmission. Therefore, the decrypted data is obfuscated before being returned to the service initiator, thereby improving the security of the data during transmission, thereby improving the security of data storage in a different location.
[0101] In some embodiments, the query request includes executing a script; the method also includes: the server decrypts the encrypted data using the first key or the second key; if third plaintext data is obtained, the server calculates the third plaintext data according to the execution script to obtain result data; the server returns the result data to the service initiator.
[0102] Optionally, in actual business scenarios, the queried data needs to be further processed, for example, further indicator calculations are performed on the queried data.
[0103] At this time, in order to avoid data leakage during transmission and to improve the security of the data calculation process, the execution script for performing the calculation is sent to the server so that the server can use the execution script to calculate the third plaintext data, obtain the result data, and finally return the result data to the business initiator.
[0104] In this process, since only one result is returned, even if the result is leaked, it is unclear which data is involved in the calculation, thus improving the security of off-site data storage.
[0105] Figure 2 A schematic diagram of the structure of an encrypted data updating device provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the device includes: a receiving module 201, a query module 202, a decryption module 203 and an encryption module 204; wherein,
[0106] The receiving module 201 is used to receive the first key sent by the key management party; the first key is generated by the key management party according to a preset update cycle; the query module 202 is used to obtain the field to be updated, and query the database based on the field to be updated to obtain the original encrypted data corresponding to the field to be updated; the decryption module 203 is used to decrypt the original encrypted data using the second key to obtain the first plaintext data; the second key is the key received before receiving the first key; the encryption module 204 is used to re-encrypt the first plaintext data using the first key to obtain the updated encrypted data.
[0107] Based on the above embodiment, the device also includes a feature generation module, which is used to segment the first plaintext data according to a preset number; perform hash processing on the data of each segment to generate a feature of each segment; obtain a total feature of the field to be updated based on the feature of each segment; and send the total feature to the key manager so that the key manager can verify the first plaintext data based on the total feature.
[0108] Based on the above embodiment, the query module 202 is specifically used to: obtain the data table name and database name to which the field to be updated belongs; construct a query statement according to the data table name and the field to be updated; and use the query statement to query the database corresponding to the database name.
[0109] Based on the above embodiment, the device also includes an update module, which is used to obtain a data identifier corresponding to each piece of data in the field to be updated; based on the data identifier, write the updated encrypted data to the corresponding position of the database to update the database.
[0110] Based on the above embodiment, the device further includes a destruction module, which is used to destroy the second key.
[0111] Based on the above embodiment, the device also includes an alarm module for receiving a query request from a service initiator; the query request includes a query identifier; the database is queried using the query identifier to obtain encrypted data; if the first key or the second key cannot decrypt the encrypted data, an alarm is issued.
[0112] Based on the above embodiment, the device also includes an obfuscation module, which is used to decrypt the encrypted data using the first key or the second key; if the second plaintext data is obtained, the second plaintext data is obfuscated to obtain obfuscated data; and the obfuscated data is returned to the service initiator.
[0113] Based on the above embodiment, the query request includes an execution script; the device also includes a computing module for decrypting the encrypted data using the first key or the second key; if third plaintext data is obtained, the third plaintext data is calculated according to the execution script to obtain result data; and the result data is returned to the service initiator.
[0114] It should be understood that the device corresponds to the above-mentioned encrypted data update method embodiment and can execute the various steps involved in the above-mentioned method embodiment. The specific functions of the device can be found in the above description. To avoid repetition, the detailed description is appropriately omitted here. The device includes at least one software function module that can be stored in a memory in the form of software or firmware or solidified in the operating system (OS) of the device.
[0115] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Figure 3 As shown, the electronic device includes a processor 301 (processor), a memory 302 (memory) and a bus 303; wherein the processor 301 and the memory 302 communicate with each other through the bus 303. The processor 301 is used to call the program instructions in the memory 302 to execute the methods provided by the above-mentioned method embodiments.
[0116] The processor 301 can be an integrated circuit chip with signal processing capabilities. The above-mentioned processor 301 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 gates or transistor logic devices, discrete hardware components. It can implement or execute various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
[0117] The memory 302 may include but is not limited to random access memory (RAM), read only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable read-only memory (EEPROM), etc.
[0118] This embodiment discloses a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the methods provided by the above-mentioned method embodiments.
[0119] This embodiment provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions enable the computer to execute the methods provided by the above-mentioned method embodiments.
[0120] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0121] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0122] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0123] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for updating encrypted data, characterized in that: The method is applied to a data storage party, and the method comprises: Receiving a first key sent by a key management party; the first key is generated by the key management party according to a preset update cycle; Acquire the field to be updated, and query the database based on the field to be updated to obtain the original encrypted data corresponding to the field to be updated; Decrypting the original encrypted data using a second key to obtain first plaintext data; the second key is a key received before receiving the first key; The first plaintext data is re-encrypted using the first key to obtain updated encrypted data.
2. The method according to claim 1, characterized in that After obtaining the first plaintext data, the method further includes: Segmenting the first plaintext data according to a preset number; Perform hash processing on the data of each segment to generate the features of each segment; Obtaining the total feature of the field to be updated based on the feature of each segment; The total feature is sent to the key management party, so that the key management party verifies the first plaintext data based on the total feature.
3. The method according to claim 1, characterized in that The querying of the database based on the field to be updated includes: Get the data table name and database name to which the field to be updated belongs; Construct a query statement according to the data table name and the field to be updated; The query statement is used to query the database corresponding to the database name.
4. The method according to claim 1, characterized in that: After obtaining the updated encrypted data, the method further includes: Obtaining a data identifier corresponding to each piece of data in the field to be updated; Based on the data identifier, the updated encrypted data is written into a corresponding position of the database to update the database.
5. The method according to claim 4, characterized in that After updating the database, the method further includes: The second key is destroyed.
6. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: receiving a query request from a service initiator; the query request includes a query identifier; Using the query identifier to query the database to obtain encrypted data; If the first key or the second key cannot decrypt the encrypted data, an alarm is issued.
7. The method according to claim 6, characterized in that The method further comprises: decrypting the encrypted data using the first key or the second key; If the second plaintext data is obtained, the second plaintext data is obfuscated to obtain obfuscated data; The obfuscated data is returned to the service initiator.
8. The method according to claim 6, characterized in that The query request includes executing a script; the method further includes: decrypting the encrypted data using the first key or the second key; If the third plaintext data is obtained, the third plaintext data is calculated according to the execution script to obtain result data; The result data is returned to the service initiator.
9. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the machine-readable instructions are executed by the processor, the method according to any one of claims 1 to 8 is performed.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is executed.
11. A computer program product, characterized in that include: A computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is executed.
Citation Information
Cited By
API key management method and device based on frequency and time
CN119402194A
