Data reading method and device
By generating keys for decryption, the problem of high resource consumption after low-level user keys are changed is solved, and efficient key management is achieved.
Patent Information
- Application Number
- CN202410609036.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-16
- Publication Date
- 2024-08-23
AI Technical Summary
When existing data storage and processing systems implement hierarchical access control, low-level user keys need to be redistributed to high-level users after changes, resulting in excessive resource consumption.
By determining the orthogonal vector set and public vector of the target user, the key for decryption is generated, reducing the resource consumption of key distribution.
Efficient key management is achieved and the resource consumption of the system when maintaining user keys is reduced.
Smart Images

Figure CN118536134A
Abstract
Description
Technical Field
[0001] The present application relates to a data reading method and device. Background Art
[0002] In order to protect data security and prevent data leakage, data storage and processing systems (such as cloud computing systems, database systems, etc.) have access control functions. Through the access control function, the system can control the system data to be read only by users who have obtained corresponding authorization.
[0003] In order to provide different access rights to users of different levels, the system usually needs to implement hierarchical access control. One way to implement hierarchical access control in related technologies is to directly distribute the keys of low-level users to high-level users, so that high-level users can decrypt the encrypted data of low-level users according to the keys.
[0004] The problem with this implementation is that when a low-level user changes the key, including but not limited to adding, modifying and deleting the key, the system needs to redistribute the changed key to multiple high-level users. Therefore, the system needs to consume more resources in maintaining the keys of each user. Summary of the invention
[0005] To this end, this application discloses the following technical solutions:
[0006] The first aspect of the present application provides a data reading method, comprising:
[0007] Determine a target user to be read by the current user, where the target user is at a lower level than the current user;
[0008] Obtaining a first key of the target user, wherein the first key is determined according to a projection of a first public vector on an orthogonal first vector set of the target user and a second public vector, wherein the orthogonal first vector set of the target user is obtained by orthogonalizing a first vector set corresponding to the target user; the first vector set includes a plurality of randomly generated and linearly independent vectors;
[0009] Reading first encrypted data of the target user, the first encrypted data is encrypted using a second key of the target user, the second key is determined according to a projection of the first public vector on an orthogonal second vector set of the target user and a second public vector, the orthogonal second vector set of the target user is obtained by an orthogonalization process of a second vector set corresponding to the target user, the second vector set corresponding to the target user includes a first vector set corresponding to the target user and a plurality of randomly generated and linearly independent vectors, and the dimensions of vectors in the second vector set and the first vector set are the same;
[0010] The first encrypted data is decrypted according to the first key to obtain decrypted data.
[0011] Optionally, also include:
[0012] Multiple users are divided into multiple categories at different levels. Each user is assigned a first vector set and a second vector set corresponding to the category to which he belongs, as well as the first vector sets of other categories at a level lower than that of the category to which he belongs. Different categories correspond to different first vector sets and different second vector sets. The first vector sets of different categories contain the same number of vectors, and the second vector sets of different categories contain the same number of vectors.
[0013] Optionally, the dividing the multiple users into multiple categories at different levels includes:
[0014] Multiple users are divided into multiple categories at different levels according to their security levels and read permission requirements.
[0015] Optionally, also include:
[0016] determining a target category among the plurality of categories;
[0017] A category processing operation is performed on the target category, wherein the category processing operation includes at least one of a category deregistration operation, a category update operation, a category deletion operation and a category addition operation.
[0018] Optionally, performing a category update operation on the target category includes at least one of the following:
[0019] canceling the first vector set and the second vector set of the target category, and a key determined according to the first vector set and the second vector set corresponding to the target category;
[0020] Obtaining an updated first vector set and an updated second vector set of the target category, assigning the updated first vector set and the updated second vector set to users of the target category, and assigning the updated first vector set to users of other categories at a higher level than the target category;
[0021] Delete the target category, the first vector set and the second vector set corresponding to the target category, and the key determined according to the first vector set and the second vector set corresponding to the target category, and cancel the first vector set, the second vector set and the corresponding key of other categories at a level lower than the target category.
[0022] Optionally, also include:
[0023] Add a new user to the category to which the current user belongs;
[0024] Allocating a first vector set and a second vector set corresponding to the category to which the current user belongs to the newly added user;
[0025] Allocating a first vector set corresponding to the category to which the target user belongs to the newly added user;
[0026] Optionally, also include:
[0027] Deleting the current user and the vector set of the current user;
[0028] canceling the first vector set, the second vector set and the corresponding key of the category to which the current user belongs;
[0029] The first vector sets, the second vector sets and the corresponding keys of other categories at a level lower than the category to which the current user belongs are cancelled.
[0030] Optionally, also include:
[0031] Move the current user from a first category to a second category, the first category is the category to which the current user belongs, and the second category is at a higher level than the first category;
[0032] assigning a first vector set and a second vector set corresponding to the second category to the current user;
[0033] A first vector set of other categories at a level lower than the second category is allocated to the current user.
[0034] Optionally, also include:
[0035] Obtaining a third key of the current user, where the third key is determined according to a projection of the first public vector on an orthogonal second vector set of the current user and a second public vector, where the orthogonal second vector set of the current user is obtained by orthogonalizing the second vector set corresponding to the current user;
[0036] The decrypted data is encrypted according to the third key to obtain the second encrypted data of the current user.
[0037] A second aspect of the present application provides a data reading device, comprising:
[0038] A determination unit, configured to determine a target user to be read by the current user, wherein the target user is located at a lower level than the current user;
[0039] an obtaining unit, configured to obtain a first key of the target user, wherein the first key is determined according to a projection of a first public vector on an orthogonal first vector set of the target user and a second public vector, wherein the orthogonal first vector set of the target user is obtained by orthogonalizing a first vector set corresponding to the target user; the first vector set includes a plurality of randomly generated and linearly independent vectors;
[0040] a reading unit, configured to read first encrypted data of the target user, the first encrypted data being encrypted by using a second key of the target user, the second key being determined according to a projection of the first public vector on an orthogonal second vector set of the target user and a second public vector, the orthogonal second vector set of the target user being obtained by an orthogonalization process of a second vector set corresponding to the target user, the second vector set corresponding to the target user comprising a first vector set corresponding to the target user and a plurality of randomly generated and linearly independent vectors, the second vector set having the same dimension as the vectors in the first vector set;
[0041] The encryption and decryption unit is used to decrypt the first encrypted data according to the first key to obtain decrypted data. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0043] Figure 1 is a flow chart of a data reading method provided in an embodiment of the present application;
[0044] Figure 2 It is a schematic diagram of a hierarchical relationship between multiple categories provided in an embodiment of the present application;
[0045] Figure 3 This is a flow chart of a method for adding a new user provided in an embodiment of the present application;
[0046] Figure 4 This is a flow chart of a method for deleting a user provided in an embodiment of the present application;
[0047] Figure 5 is a structural schematic diagram of a data reading device provided in an embodiment of the present application;
[0048] Figure 6 It is a structural schematic diagram of another data reading device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0050] This embodiment provides a data reading method, see Figure 1 , is a flow chart of the method, and the method may include the following steps.
[0051] S101, determining a target user to be read by the current user, where the target user is at a lower level than the current user.
[0052] The data reading method provided in this embodiment can be executed by a data processing system (hereinafter referred to as the system) deployed on a server, such as a cloud computing system, a database system, or a large language model system.
[0053] The current user may be any user who has registered in the system and is currently logged in to the system through any user terminal device.
[0054] The target user can be any user who has registered in the system and whose level is lower than that of the current user.
[0055] The target user may be determined by the system first determining the data to be read by the current user, then determining which users in the system the data to be read belongs to, and determining a user whose level is lower than that of the current user among the users to whom the data to be read belongs as the target user.
[0056] As an example, based on the operation of current user A, the system determines that the current user wants to read the weather data of a certain area in the past week, and then determines that the weather data belongs to user B and user C in the system, where user B is at a lower level than user A, so the system determines user B as the target user to be read.
[0057] The target user may be determined in such a way that each user in the system may have unique user identification information for uniquely identifying the user identity, and the system may obtain the user identification information input by the current user and determine the user corresponding to the input user identification information as the target user.
[0058] S102, obtaining a first key of the target user, the first key is determined according to a projection of a first common vector on an orthogonal first vector set of the target user and a second common vector, the orthogonal first vector set of the target user is obtained by orthogonalizing a first vector set corresponding to the target user; the first vector set includes a plurality of randomly generated and linearly independent vectors.
[0059] The first public vector and the second public vector may be pre-generated by the system before executing S102 and stored in a server device of the system. When any user in the system needs to encrypt or decrypt data, the first public vector and the second public vector may be read from the server device to obtain the keys required for encryption or decryption according to the first public vector and the second public vector.
[0060] The dimensions of the vectors in the first vector set are the same, and the dimensions of the first common vector and the second common vector are the same as the dimensions of the vectors in the first vector set. That is, the dimensions of the vectors in the first vector set, the dimensions of the first common vector, and the dimensions of the second common vector are all m. m can be determined by the system, and its value is not limited. As an example, m can be equal to 50, or equal to 100, or equal to other values.
[0061] The first key may be obtained by:
[0062] Orthogonalize the first vector set Si of the target user to obtain an orthogonal first vector set S⊥i of the target user, where i can indicate that the target user is the i-th user in the system, or that the category to which the target user belongs is the i-th category in the system; the system can use a variety of orthogonalization algorithms to implement orthogonalization of the first vector set, and this embodiment does not limit the algorithm used. As an example, the system can use the Gram-Schmidt orthogonalization algorithm to perform orthogonalization;
[0063] Calculate the projection of the first common vector F1 on the orthogonal first vector set S⊥i of the target user to obtain the orthogonal first projection vector F*(1, i). The calculation method of the projection can be found in the relevant technical information;
[0064] An inner product operation is performed on the orthogonal first projection vector F*(1, i) and the second common vector F2 to obtain the first key Ki of the target user.
[0065] In some optional embodiments, after the current user obtains the first key of the target user in the above manner for the first time, the first key of the target user can be stored on the user terminal device used by the current user. In this way, when the data of the target user needs to be read again, the first key can be obtained by reading the first key of the target user from the user terminal device of the current user.
[0066] S103, read the first encrypted data of the target user, the first encrypted data is encrypted using the second key of the target user, the second key is determined according to the projection of the first public vector on the orthogonal second vector set of the target user and the second public vector, the orthogonal second vector set of the target user is obtained by orthogonalizing the second vector set corresponding to the target user, the second vector set corresponding to the target user includes the first vector set corresponding to the target user and multiple randomly generated and linearly independent vectors, and the dimensions of the vectors in the second vector set and the first vector set are the same.
[0067] The method for obtaining the second key of the target user is similar to the method for obtaining the first key of the target user. It is only necessary to replace the first vector set of the target user in the method for obtaining the first key with the second vector set of the target user, which will not be described in detail.
[0068] The second vector set of the target user may include the first vector set of the target user, and further include a plurality of randomly generated and linearly independent vectors.
[0069] If the second vector set of the target user is recorded as Bi, and the first vector set of the target user is recorded as Si, the relationship between the two can be expressed as Bi = (Pi, Si). Pi is another vector set different from the first vector set, the dimension of the vectors in Pi is consistent with the dimension of the vectors in Si, and the multiple vectors contained in Pi are also randomly generated and linearly independent vectors.
[0070] The number of vectors included in Si may be equal to a characteristic length s preset by the system. In other words, for each user in the system, the first vector set corresponding to the user may include s randomly generated and linearly independent vectors.
[0071] The number of vectors included in Pi can be equal to ns, where n is the vector length n preset by the system. Correspondingly, the number of vectors in the second vector set can be equal to n. In other words, for each user in the system, the second vector set corresponding to the user may include n randomly generated and linearly independent vectors, including the first vector set of the user, and ns randomly generated and linearly independent vectors other than the first vector set.
[0072] When the system sets the vector length n and the characteristic length s, n may be set to be smaller than the dimension m of the vectors in the first vector set, and s may be set to be smaller than n.
[0073] Similar to S102, when the target user's data is encrypted for the first time, the target user's second vector set can be orthogonalized, projected, and the inner product can be calculated to determine the target user's second key. Thereafter, the target user's second key can be stored in the system's server or in the target user's user terminal device. When the target user's data needs to be encrypted again, the target user's second key can be read directly from the server or the target user's user terminal device.
[0074] The first key and the second key may be the same key, whereby data encrypted based on the symmetric encryption algorithm and the second key may be decrypted based on the symmetric encryption algorithm and the first key.
[0075] Alternatively, the first key and the second key can be two different keys, and the first key and the second key are a set of mutually matching keys in an asymmetric encryption algorithm, whereby data encrypted based on the asymmetric encryption algorithm and the second key can be decrypted based on the asymmetric encryption algorithm and the first key.
[0076] S104, decrypt the first encrypted data according to the first key to obtain decrypted data.
[0077] In step S104, the system can read all the first encrypted data belonging to the target user, then encrypt the first encrypted data using the first key, obtain the corresponding decrypted data, and send the decrypted data to the user terminal device of the current user; or, after obtaining the decrypted data, the system can process the decrypted data according to the operation of the current user, such as inputting the decrypted data into a large model for analysis, and sending the obtained processing results to the user terminal device of the current user.
[0078] The beneficial effects of this embodiment are:
[0079] When the current user at a high level needs to read the data of the target user at a low level, he can directly obtain the first key for decrypting the first encrypted data according to the first vector set of the target user. Every time the key of the user at a low level needs to be changed, the system only needs to change the first vector set corresponding to the user at a lower level, and the user at the high level can obtain the changed key according to the changed first vector set, without the need for the system to distribute the changed key one by one. Therefore, compared with the access control scheme of the related art, the access control based on the data reading method of this embodiment is conducive to reducing the resources consumed by the system when maintaining the keys of each user.
[0080] In some optional embodiments, the system may determine the first vector set and the second vector set corresponding to each user in the following manner:
[0081] Multiple users are divided into multiple categories at different levels. Each user is assigned a first vector set and a second vector set corresponding to the category to which he belongs, as well as the first vector sets of other categories at a level lower than that of the category to which he belongs. Different categories correspond to different first vector sets and different second vector sets. The first vector sets of different categories contain the same number of vectors, and the second vector sets of different categories contain the same number of vectors.
[0082] In this embodiment, the system can determine the first vector set and the second vector set corresponding to each category, and then assign the first vector set and the second vector set corresponding to the category to the users included in the category. That is to say, in this embodiment, the first vector set and the second vector set corresponding to any user are equivalent to the first vector set and the second vector set corresponding to the category to which the user belongs.
[0083] Depending on the actual situation, the system can be divided into any number of categories at different levels, and this embodiment does not limit the results of the division.
[0084] As an example, see Figure 2 (1), in this embodiment, the system can divide multiple users into 7 categories, which are marked as C1 to C7. The hierarchical relationship of these 7 categories is as follows: Figure 2 As shown in (1), it can be seen that C4 and C5 are at a lower level than C2, C6 and C7 are at a lower level than C3, and C2 and C3 are at a lower level than C1.
[0085] After the categories are divided, for each category, the system can determine the first vector set and the second vector set corresponding to each category according to the preset vector dimension m, vector length n and characteristic length s.
[0086] Taking C4 as an example, the system can first randomly generate s m-dimensional and mutually linearly independent vectors, and determine these s vectors as the first vector set corresponding to the C4 category, denoted as S4. In addition, the system can randomly generate ns m-dimensional and mutually linearly independent vectors, and determine these ns vectors as the vector set P4 corresponding to the C4 category, and determine the combination of S4 and P4 B4 = (S4, P4) as the second vector set corresponding to the C4 category.
[0087] Among them, for each category, after determining the first vector set and the second vector set of the category, the system can compare the first vector set of the category with the first vector sets determined by other categories to ensure that the first vector sets of each category are different, and can compare the second vector set of the category with the second vector sets determined by other categories to ensure that the second vector sets of each category are different. If it is found that the first vector sets of different categories are repeated, or the second vector sets of different categories are repeated, the system can delete the repeated first vector set or second vector set and generate a new first vector set or second vector set.
[0088] For each category, after determining the first vector set corresponding to the category, the system can assign the first vector set and the second vector set of the category to each user included in the category, and assign the first vector set of the category to users of other categories at a higher level than the category.
[0089] Still taking the C4 category as an example, Figure 2 In the hierarchical relationship shown in (1), C2 is at a higher level than C4, and C1 is at a higher level than C2, and obviously also higher than C4. Therefore, after the system determines S4 and B4, it assigns S4 and B4 to each user included in the C4 category. At the same time, it assigns S4 to each user in the C2 category who is at a higher level than C4, and to each user in the C1 category.
[0090] Allocating a first vector set and a second vector set of any category to a user may include the following operations:
[0091] On the one hand, the system records the mapping relationship between the vector set and the assigned user, so that the corresponding user can read and use the corresponding vector set to generate a key.
[0092] On the other hand, the system may send the vector set to the user terminal device used by the assigned user, so that the user can directly read and use the corresponding vector set from the user terminal device when the user needs to obtain the key.
[0093] Combined with the above example, assuming that category C1 includes user D, category C2 includes user A, and category C4 includes users B and C, the system can perform the following operations after determining the first vector set S4 and the second vector set B4 corresponding to category C4:
[0094] Record that user B corresponds to S4 and B4, user C corresponds to S4 and B4, user A corresponds to S4, and user D corresponds to S4;
[0095] S4 and B4 are sent to the user terminal equipment of user B and to the user terminal equipment of user C, and S4 is sent to the user terminal equipment of user A and to the user terminal equipment of user D.
[0096] The beneficial effects of this embodiment are:
[0097] When there are multiple users in the system, dividing the users into multiple categories and determining corresponding first vector sets and second vector sets by category can reduce the number of first vector sets and second vector sets that need to be stored in the system and save storage resources of server devices of the system.
[0098] The system can classify multiple users into multiple categories according to multiple classification strategies. Examples of several optional classification strategies are provided below.
[0099] An optional division strategy is to divide the categories according to the amount of data that multiple users have in the system, with users with more data being divided into higher-level categories and users with less data being divided into lower-level categories, or users with more data being divided into lower-level categories and users with less data being divided into higher-level categories.
[0100] Another optional classification strategy is to classify multiple users according to their registration time, with users who registered earlier being classified into higher-level categories and users who registered later being classified into lower-level categories; alternatively, users who registered earlier being classified into lower-level categories and users who registered later being classified into higher-level categories.
[0101] Another optional division strategy is to divide multiple users into multiple categories at different levels according to their security levels and read permission requirements. The higher the security level of a user, the more read permissions he requires, and the higher the level he is divided into; the lower the security level of a user, the fewer read permissions he requires, and the lower the level he is divided into.
[0102] In some optional embodiments, after the categories are divided, the system can also perform permission management by category, that is, the system can determine the target category among multiple categories, and then perform category processing operations on the target category. The category processing operations include at least one of category deregistration operations, category update operations, category deletion operations and category addition operations.
[0103] Category deregistration actions may include:
[0104] The first vector set and the second vector set of the target category and the key determined according to the first vector set and the second vector set corresponding to the target category are cancelled.
[0105] Deregistering the first vector set and the second vector set of the target category may include deleting the first vector set and the second vector set of the target category from a server of the system and a user terminal device of each user, and deleting the correspondence between the first vector set and the second vector set and the user.
[0106] Deregistering the key may include deleting the key determined according to the first vector set and the second vector set of the target category from a server of the system and a user terminal device of each user.
[0107] Combined with the previous example, if the target category is C4, the system can delete B4 and S4 from the server, delete the correspondence between B4 and users B and C, delete the correspondence between S4 and users A, B, C and D, delete B4 and S4 from the user terminal devices of users B and C, and delete S4 from the user terminal devices of users A and D.
[0108] Optionally, after executing the category deregistration operation, the system may reinitialize the deregistered target category, that is, re-determine a new first vector set and a second vector set for the target category, and redistribute them to the corresponding users in the aforementioned allocation manner.
[0109] The category update operation may include obtaining an updated first vector set and an updated second vector set of the target category, assigning the updated first vector set and the updated second vector set to users of the target category, and assigning the updated first vector set to users of other categories at a higher level than the target category.
[0110] That is, the system can regenerate the updated first vector set and the updated second vector set corresponding to the target category, and then reallocate the updated first vector set and the updated second vector set to the corresponding user in the aforementioned allocation manner to replace the original first vector set and the second vector set.
[0111] Taking the target category C4 as an example, the system can generate an updated S4 different from S4, an updated B4 different from B4, and assign the updated S4 and updated B4 to users B and C in the C4 category, and assign the updated S4 to user A in the C2 category, and user D in the C1 category.
[0112] Category deletion operations can include:
[0113] Delete the target category, the first vector set and the second vector set corresponding to the target category, and the key determined according to the first vector set and the second vector set corresponding to the target category, and cancel the first vector set, the second vector set and the corresponding key of other categories at a level lower than the target category.
[0114] Deleting a target category may include removing the target category from the hierarchical relationship of various categories recorded in the system, and correspondingly updating the hierarchical relationship between the categories that have not been removed, for example, after deleting the target category, the lower-level category is moved up one level. The lower-level category refers to other categories that are at a lower level than the target category.
[0115] Deleting the first vector set and the second vector set corresponding to the target category, and determining the key according to the first vector set and the second vector set corresponding to the target category may include:
[0116] Deleting the first vector set and the second vector set of the target category from the server of the system and the user terminal device of each user, and deleting the corresponding relationship between the first vector set and the second vector set and the user;
[0117] The key determined according to the first vector set and the second vector set of the target category is deleted from the server of the system and the user terminal device of each user.
[0118] Different from deregistration, in the category deletion operation, the system no longer regenerates a new first vector set and a new second vector set corresponding to the target category.
[0119] Furthermore, the system also performs category deregistration operations on each lower-level category. The operation method is described above.
[0120] For example, when the target category is C2, the system deletes the C2 category in the hierarchical relationship and moves the corresponding lower-level categories C4 and C5 up one level. The updated hierarchical relationship is as follows: Figure 2 As shown in (2); at the same time, the system deletes the first vector set S2 and the second vector set B2 corresponding to C2, as well as the key generated according to S2 and / or B2, and performs category deregistration operations on C4 and C5.
[0121] Optionally, after the target category is deleted, the system can deregister the users included in the target category, or reclassify the users of the target category into other non-deleted categories based on security levels and permission requirements.
[0122] Category addition operations can include:
[0123] The original hierarchical relationship is updated according to the hierarchical relationship between the newly added target category and other original categories, and the target category is added to the original hierarchical relationship. At the same time, the system determines the first vector set and the second vector set corresponding to the target category, and assigns the first vector set and the second vector set corresponding to the target category to the corresponding user.
[0124] For example, suppose that a target category C8 whose level is lower than C2 needs to be added. Figure 2 Add C8 to the hierarchical relationship shown in (1), and we get Figure 2 The updated hierarchical relationship is shown in (3), and the first vector set S8 and the second vector set B8 corresponding to C8 are determined in the aforementioned manner, S8 and B8 are assigned to the users included in C8, and S8 is assigned to the users of C2 and C1 whose hierarchies are higher than C8.
[0125] Optionally, after adding a new target category, the system can classify some users included in the original category into the target category, or classify newly registered users into the target category.
[0126] In this embodiment, after the system has divided the categories, it can also add one or more users to any category. The following takes adding a user to the category to which the current user belongs as an example to illustrate the method of adding a user. Figure 3 , which is a flowchart of a method for adding a new user to a category provided in this embodiment. The method may include the following steps.
[0127] S301, adding a new user to the category to which the current user belongs.
[0128] S302: Allocate a first vector set and a second vector set corresponding to the category to which the current user belongs to a new user.
[0129] S303: Allocate a first vector set corresponding to the category to which the target user belongs to the newly added user.
[0130] In S301, the newly added user may be a user who has just registered with the system and whose category has not yet been determined, or a user whose original category has been deleted and needs to be reclassified.
[0131] In S302 and S303, taking the current user belonging to category C2 and the target user belonging to category C4 as an example, the system can assign the first vector sets S2 and B2 corresponding to C2 to the newly added user, and the first vector set S4 corresponding to C4 to the newly added user. In addition, the first vector sets of other categories at a level lower than C2, such as Figure 2 The first vector set S5 corresponding to the C5 category shown in (1) is also allocated to the newly added user.
[0132] In this embodiment, the system can also delete one or more users from any category after the categories are divided. The following takes deleting the current user from the category to which the current user belongs as an example to illustrate the method of deleting a user. Figure 4 , is a flowchart of a method for deleting a user in a category provided in this embodiment, and the method may include the following steps.
[0133] S401, deleting the current user and the vector set of the current user.
[0134] S402: cancel the first vector set, the second vector set and the corresponding key of the category to which the current user belongs.
[0135] S403 , canceling first vector sets, second vector sets, and corresponding keys of other categories at a level lower than the category to which the current user belongs.
[0136] Deleting the current user may include deleting the current user's registration information from the server, thereby logging out of the current user.
[0137] Delete the vector set of the current user, which can include:
[0138] Deleting each previously sent vector set from the user terminal device of the current user, including the first vector set and the second vector set corresponding to the category to which the current user belongs, and the first vector sets of other categories at a lower level than the category to which the current user belongs;
[0139] Deleting each key determined according to the vector sets from the user terminal device of the current user;
[0140] The correspondence between the current user and these vector sets is deleted in the server of the system.
[0141] Taking the current user's category C2 as an example, the system can delete B2, S2, S4 and S5 sent to the current user's user terminal device, delete the various keys determined according to B2, S2, S4 and S5 in the current user's user terminal device, and delete the correspondence between the current user and B2, S2, S4 and S5 in the system's server.
[0142] In step S402, the system may determine the category to which the current user belongs as the target category, and perform a category deregistration operation on the target category.
[0143] In step S403, the system may determine each other category at a level lower than the category to which the current user belongs as a target category, and perform a category deregistration operation on each target category.
[0144] Taking the category C2 to which the current user belongs as an example, after deleting the current user and the vector set of the current user, the system can perform a category deregistration operation on C2, and perform a category deregistration operation on C4 and C5 which are at a level lower than C2.
[0145] In this embodiment, the system can also change the category of any user after the classification is completed, for example, moving a user to a higher-level category or to a lower-level category.
[0146] Taking the current user as an example, the methods for moving the current user to a higher-level category may include:
[0147] Move the current user from the first category to the second category, the first category is the category to which the current user belongs, and the second category is at a higher level than the first category;
[0148] assigning the first vector set and the second vector set corresponding to the second category to the current user;
[0149] The first vector sets of other categories at a level lower than the second category are assigned to the current user.
[0150] Taking the first category as C2 and the second category as C1 as an example, the system can move the current user from C2 to the higher-level C1, and assign the first vector sets S1 and B1 corresponding to C1 to the current user. Since S2 has been assigned when the current user belongs to C2, after moving to C1, the first vector set S3 of C3, which is at a lower level than C1, can be assigned to the current user.
[0151] Ways to move the current user to a lower level category include:
[0152] Move the current user from the first category to the third category, where the first category is the category to which the current user belongs, and the third category is at a lower level than the first category;
[0153] Delete the vector sets of high-level categories and same-level categories assigned to the current user, where high-level categories refer to other categories whose levels are higher than the third category, and same-level categories refer to other categories whose levels are the same as the third category;
[0154] The second vector set corresponding to the third category is assigned to the current user.
[0155] Taking the first category as C2 and the third category as C4 as an example, the system can first move the current user from C2 to C4, and then delete the vector sets of the high-level categories and the same-level categories previously assigned to the current user, that is, delete the previously assigned S2 and B2, as well as the previously assigned first vector set S5 of the same-level category C5 from the user terminal device of the current user, and simultaneously delete the keys determined according to these vector sets in the user terminal device, and delete the correspondence between the current user and these vector sets in the server, and finally assign the second vector set B4 of the third category to the current user. At this time, the current user has the first vector set S4 and the second vector set B4 corresponding to the third category.
[0156] In some optional embodiments, after obtaining the decrypted data of the target user, the system may further process the decrypted data of the target user.
[0157] As an example, when the affiliation of the target user's decrypted data needs to be changed, for example, the decrypted data belonging to the target user needs to be changed to belong to the current user, the system can perform the following steps after obtaining the target user's decrypted data:
[0158] Obtaining a third key of the current user, where the third key is determined according to a projection of the first common vector on an orthogonal second vector set of the current user and a second common vector, where the orthogonal second vector set of the current user is obtained by orthogonalizing the second vector set corresponding to the current user;
[0159] The data is encrypted and decrypted according to the third key to obtain the second encrypted data of the current user.
[0160] The method for obtaining the third key of the current user can refer to the method for obtaining the first key of the target user according to the first vector set of the target user mentioned above, which will not be described in detail.
[0161] After obtaining the second encrypted data, the system can delete the first encrypted data of the target user. In this way, the decrypted data originally belonging to the target user in the system is encrypted by the current user, and the target user at a lower level than the current user can no longer obtain these decrypted data. These decrypted data can only be obtained by the current user and other users at a higher level than the current user, thereby realizing the change of ownership of the decrypted data from the target user to the current user.
[0162] This embodiment also provides a data reading device, see Figure 5 , is a schematic diagram of the structure of the device, and the device may include the following units.
[0163] A determination unit 501 is used to determine a target user to be read by the current user, where the target user is at a lower level than the current user;
[0164] An obtaining unit 502 is used to obtain a first key of a target user, where the first key is determined according to a projection of a first public vector on an orthogonal first vector set of the target user and a second public vector, where the orthogonal first vector set of the target user is obtained by orthogonalizing a first vector set corresponding to the target user; the first vector set includes a plurality of randomly generated and linearly independent vectors;
[0165] A reading unit 503 is used to read first encrypted data of a target user, where the first encrypted data is encrypted using a second key of the target user, where the second key is determined based on a projection of a first public vector on an orthogonal second vector set of the target user and a second public vector, where the orthogonal second vector set of the target user is obtained by orthogonalizing a second vector set corresponding to the target user, where the second vector set corresponding to the target user includes a first vector set corresponding to the target user and a plurality of randomly generated and linearly independent vectors, and the dimensions of the vectors in the second vector set and the first vector set are the same;
[0166] The encryption and decryption unit 504 is used to decrypt the first encrypted data according to the first key to obtain decrypted data.
[0167] In some optional embodiments, see Figure 6 The device may further include a dividing unit 601, configured to:
[0168] Multiple users are divided into multiple categories at different levels. Each user is assigned a first vector set and a second vector set corresponding to the category to which he belongs, as well as the first vector sets of other categories at a level lower than that of the category to which he belongs. Different categories correspond to different first vector sets and different second vector sets. The first vector sets of different categories contain the same number of vectors, and the second vector sets of different categories contain the same number of vectors.
[0169] Optionally, when the division unit 601 divides the multiple users into multiple categories at different levels, it is specifically used to:
[0170] Multiple users are divided into multiple categories at different levels according to their security levels and read permission requirements.
[0171] Optionally, the device may further include a processing unit 602 configured to:
[0172] Identify target categories among multiple categories;
[0173] A category processing operation is performed on the target category, where the category processing operation includes at least one of a category deregistration operation, a category update operation, a category deletion operation, and a category addition operation.
[0174] Optionally, the processing unit 602 performs a category update operation on the target category, including at least one of the following:
[0175] deregistering the first vector set and the second vector set of the target category, and a key determined according to the first vector set and the second vector set corresponding to the target category;
[0176] Obtaining an updated first vector set and an updated second vector set of a target category, assigning the updated first vector set and the updated second vector set to users of the target category, and assigning the updated first vector set to users of other categories at a higher level than the target category;
[0177] Delete the target category, the first vector set and the second vector set corresponding to the target category, and the key determined according to the first vector set and the second vector set corresponding to the target category, and cancel the first vector set, the second vector set and the corresponding key of other categories at a level lower than the target category.
[0178] Optionally, the processing unit 602 is further configured to:
[0179] Add a new user to the category to which the current user belongs;
[0180] Allocate the first vector set and the second vector set corresponding to the category to which the current user belongs to the newly added user;
[0181] Assigning a first vector set corresponding to the category to which the target user belongs to the newly added user;
[0182] Optionally, the processing unit 602 is further configured to:
[0183] Delete the current user and the vector set of the current user;
[0184] Deregister the first vector set, the second vector set and the corresponding key of the category to which the current user belongs;
[0185] The first vector sets, the second vector sets and the corresponding keys of other categories at a level lower than the category to which the current user belongs are cancelled.
[0186] Optionally, the processing unit 602 is further configured to:
[0187] Move the current user from the first category to the second category, the first category is the category to which the current user belongs, and the second category is at a higher level than the first category;
[0188] assigning the first vector set and the second vector set corresponding to the second category to the current user;
[0189] The first vector sets of other categories at a level lower than the second category are assigned to the current user.
[0190] Optionally, the obtaining unit 502 is further configured to:
[0191] Obtaining a third key of the current user, where the third key is determined according to a projection of the first common vector on an orthogonal second vector set of the current user and a second common vector, where the orthogonal second vector set of the current user is obtained by orthogonalizing the second vector set corresponding to the current user;
[0192] The encryption and decryption unit 504 is also used for:
[0193] The data is encrypted and decrypted according to the third key to obtain the second encrypted data of the current user.
[0194] The working principle of the data reading device of this embodiment can refer to the relevant steps of the data reading method provided in any embodiment of the present application, and will not be repeated here.
[0195] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0196] For the convenience of description, the above system or device is described by dividing it into various modules or units according to its functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0197] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.
[0198] Finally, it should be noted that, in this article, relational terms such as first, second, third and fourth are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0199] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A data reading method, comprising: Determine a target user to be read by the current user, where the target user is at a lower level than the current user; Obtaining a first key of the target user, wherein the first key is determined according to a projection of a first public vector on an orthogonal first vector set of the target user and a second public vector, wherein the orthogonal first vector set of the target user is obtained by orthogonalizing a first vector set corresponding to the target user; the first vector set includes a plurality of randomly generated and linearly independent vectors; Reading first encrypted data of the target user, the first encrypted data is encrypted using a second key of the target user, the second key is determined according to a projection of the first public vector on an orthogonal second vector set of the target user and a second public vector, the orthogonal second vector set of the target user is obtained by an orthogonalization process of a second vector set corresponding to the target user, the second vector set corresponding to the target user includes a first vector set corresponding to the target user and a plurality of randomly generated and linearly independent vectors, and the dimensions of vectors in the second vector set and the first vector set are the same; The first encrypted data is decrypted according to the first key to obtain decrypted data.
2. The method according to claim 1, further comprising: Multiple users are divided into multiple categories at different levels. Each user is assigned a first vector set and a second vector set corresponding to the category to which he belongs, as well as the first vector sets of other categories at a level lower than that of the category to which he belongs. Different categories correspond to different first vector sets and different second vector sets. The first vector sets of different categories contain the same number of vectors, and the second vector sets of different categories contain the same number of vectors.
3. The method according to claim 2, wherein the step of classifying the plurality of users into a plurality of categories at different levels comprises: Multiple users are divided into multiple categories at different levels according to their security levels and read permission requirements.
4. The method according to claim 2, further comprising: determining a target category among the plurality of categories; A category processing operation is performed on the target category, wherein the category processing operation includes at least one of a category deregistration operation, a category update operation, a category deletion operation and a category addition operation.
5. The method according to claim 4, wherein the performing a category update operation on the target category comprises at least one of the following: canceling the first vector set and the second vector set of the target category, and a key determined according to the first vector set and the second vector set corresponding to the target category; Obtaining an updated first vector set and an updated second vector set of the target category, assigning the updated first vector set and the updated second vector set to users of the target category, and assigning the updated first vector set to users of other categories at a higher level than the target category; Delete the target category, the first vector set and the second vector set corresponding to the target category, and the key determined according to the first vector set and the second vector set corresponding to the target category, and cancel the first vector set, the second vector set and the corresponding key of other categories at a level lower than the target category.
6. The method according to claim 2, further comprising: Add a new user to the category to which the current user belongs; Allocating a first vector set and a second vector set corresponding to the category to which the current user belongs to the newly added user; Allocate a first vector set corresponding to the category to which the target user belongs to the newly added user.
7. The method according to claim 2, further comprising: Deleting the current user and the vector set of the current user; canceling the first vector set, the second vector set and the corresponding key of the category to which the current user belongs; The first vector sets, the second vector sets and the corresponding keys of other categories at a level lower than the category to which the current user belongs are cancelled.
8. The method according to claim 2, further comprising: Move the current user from a first category to a second category, the first category is the category to which the current user belongs, and the second category is at a higher level than the first category; assigning a first vector set and a second vector set corresponding to the second category to the current user; A first vector set of other categories at a level lower than the second category is allocated to the current user.
9. The method according to claim 1, further comprising: Obtaining a third key of the current user, where the third key is determined according to a projection of the first public vector on an orthogonal second vector set of the current user and a second public vector, where the orthogonal second vector set of the current user is obtained by orthogonalizing the second vector set corresponding to the current user; The decrypted data is encrypted according to the third key to obtain the second encrypted data of the current user.
10. A data reading device, comprising: A determination unit, configured to determine a target user to be read by the current user, wherein the target user is located at a lower level than the current user; an obtaining unit, configured to obtain a first key of the target user, wherein the first key is determined according to a projection of a first public vector on an orthogonal first vector set of the target user and a second public vector, wherein the orthogonal first vector set of the target user is obtained by orthogonalizing a first vector set corresponding to the target user; the first vector set includes a plurality of randomly generated and linearly independent vectors; a reading unit, configured to read first encrypted data of the target user, the first encrypted data being encrypted by using a second key of the target user, the second key being determined according to a projection of the first public vector on an orthogonal second vector set of the target user and a second public vector, the orthogonal second vector set of the target user being obtained by an orthogonalization process of a second vector set corresponding to the target user, the second vector set corresponding to the target user comprising a first vector set corresponding to the target user and a plurality of randomly generated and linearly independent vectors, the second vector set having the same dimension as the vectors in the first vector set; The encryption and decryption unit is used to decrypt the first encrypted data according to the first key to obtain decrypted data.
