A kind of outsourced database query result verification method and system thereof
Technical field
The present invention relates to a kind of Query Result verification method and system thereof, relate in particular to a kind of Outsourced database (annotating: entrust) Query Result verification method and system thereof in the database of third party's operation, can be used for the authenticity and the completeness of outsourcing database SQL Query Result are verified, belong to computer software technical field.
Background technology
Since nineteen nineties, service outsourcing develops into an important content of economic globalization gradually.The IT service outsourcing can help enterprise to reduce cost, and improves service quality, and strengthens self competitive power.Increasing manufacturer is selected its non-core services outsourcing, thereby pooling of resources and energy are put into core business.IT service outsourcing in recent years progressively is developed to business workflow outsourcing by simple IT infrastructure outsourcing.Because business datum is kept in the Database Systems in most of infosystems, this inevitably need be with Database Systems and service outsourcing (hereinafter to be referred as Outsourced database) thereof.A typical scene is: data-base content supplier (being called for short the owner) submits to Database Systems operation service provider (being called for short the server) with Outsourced database, and the latter disposes storage, the management of data base management system (DBMS) and responsible Outsourced database and safeguards.Database user (user) proposes query requests and obtains return results to the server.The triadic relation as shown in Figure 1.
Because from the owner and user's angle, the server is not credible fully, for the business datum of enterprise has brought new security risk so database service wraps in when bringing above-mentioned every advantage outward yet.In order to prevent database service person, need enough technological means to guarantee the correctness of Outsourced database to arbitrarily the distorting of data.From domestic consumer's angle, when requirement is initiated SQL query and obtained query results Outsourced database, can also verify the correctness of this query results, thereby be sure of that the server is in the database service that is providing secure and trusted to rely.Particularly, the correctness of query results comprises result's authenticity and completeness.Authenticity is that data come from database owner really, is not that the server forges; Completeness explanation server has returned all and has met the data content of querying condition, does not omit, perhaps in order to improve the correct result of a reason returning part such as system throughput.
Existing multiple cryptographic technique can the validation database tuple authenticity, for example various hashing algorithms (SHA-1 etc.), Digital Signature Algorithm (RSA Algorithm, DSA algorithm etc.), and message authentication code (MAC) etc. all can be used for finding distorting the tuple content.Yet tuple level protection can't check out that tuple is lost, tuple repeats other situations such as insertion.Above-mentioned algorithm faces following difficulty when realizing the protection of inquiry completeness: on the one hand, if database owner is signed whole tables of data content, all the elements could be verified during then the user need obtain showing, and user's part tuple in the question blank only in most cases, thereby the obvious cost of this way is excessive; On the other hand, database owner can't be predicted the content that the user will inquire about, and also can not carry out online response to user inquiring checking request.Therefore traditional information integrity guard method can not directly apply to the SQL query result verification of Outsourced database.
There is a kind of typical solution at the problems referred to above at present, requires the owner, abbreviate AS as in advance for each table in the Outsourced database calculates the special checking structure of a similar index tree.Tables of data is transferred to the server with AS to be safeguarded.The data base management system (DBMS) (being called for short DBMS) that operates in server's end is calculated and returns this result's authorization information according to AS when returning the SQL query result.Particularly, these class methods have following specific (special) requirements to DBMS: the special storage organization of (1) expansion.AS is a kind of special data index that has authorization information, needs to increase its structure of definition and management method; (2) expanding query authentication function.DBMS calculates and returns corresponding authorization information when the SQL query result is provided; (3) special communications protocol is returned identifying object or the like when returning the SQL query result.
Clearly, this method and SQL standard are also incompatible, and present commercial DBMS can't satisfy this specific demand.Therefore this enquiry and verification method can't be applied in practice.
Summary of the invention
At the problems referred to above, the invention provides an outsourced database query result verification method and system, support that domestic consumer carries out authenticity and completeness verification to the SQL query result that Outsourced database returned.This verification method can find in time whether the related data-base content of query results is destroyed, and for example whether has unnecessary tuple, and tuple is lost, or the tuple content such as is distorted at situation.This verification method is transparent for server, only needs database service person that normal database service is provided, and therefore allows the server directly to use the commercial or DBMS that increases income (as Oracle, SQL Server, PostgreSQL etc.) of existing main flow, need not any transformation.In addition, compare with existing method, verification method proposed by the invention and system be the locator data position of distorting accurately, obtains the correct result set of part.
Particularly, outsourced database query result verification method of the present invention comprises two core contents: Outsourced database encapsulation, and SQL query result verification.
(1) Outsourced database encapsulation
The Outsourced database encapsulation process occurs in the owner and surrenders before the database, and its effect is that each raw data table in the storehouse is carried out pre-service, embeds integrity protection information.Outsourced database after the encapsulation can be submitted to server's operation, and wherein embedded information is supported the Query Result checking of user to the tables of data content.This encapsulation process can realize by following steps:
The first step, embedding order object in database table.
The order object comprises two classes: (1) two border tuple: minimum border tuple t
Min, its value is less than all tuple attributes values in the table; And maximum border tuple t
Max, its value is greater than all tuple attributes values in the table.But no matter the database tuple is sorted t according to any ordering attribute
MinWith t
MaxIt all is respectively the bound of tuple sequence.(2) sequence notation of each tuple.This is marked with several components, each component be used for the minute book tuple in the next-door neighbour forerunner's tuple on certain attribute (but that is: because the order of tuple on each ordering attribute may be different, but can select several ordering attribute respectively tuple to be carried out sequence notation, the next-door neighbour forerunner tuple of each mark component minute book tuple on a corresponding attribute.Next-door neighbour's forerunner tuple is: on a certain attribute, the property value of certain tuple is the most contiguous and less than the property value of this tuple, this tuple is called next-door neighbour forerunner's tuple of this tuple on this attribute).The content of mark both can be its major key, major key hash value, ID numbering etc. directly marks, also can be indirect mark, for example write down the various ways such as difference between its ID and this tuple ID.The present invention does not do particular determination.From maximum border tuple, can travel through all tuples just until minimum border tuple according to any one sequence notation component, all tuples constitute a complete daisy chaining.A plurality of sequence notation components are kept at the sequence notation attribute A of an expansion after compression
SeqIn.
The present invention is by inserting border, upper and lower boundary tuple t
MinWith t
Max, can better realize the completeness of Query Result.
In second step, in database table, embed identifying object.
Identifying object is the integrity check value of each tuple content, is used for the integrality of each tuple of proof list.The information integrity protection algorithm that can select the current password technology to be supported is single tuple calculation of integrity proof test value.The present invention does not do specific (special) requirements.For example it can be the owner according to the digital signature of its private key to this tuple, also can be a message authentication code (MAC), its key is shared with the user by the owner.Because the order of embedding object in step 1, this moment, the tuple content comprised original tuple and sequence notation thereof.Identifying object is stored in the checking attribute A of another new expansion
VrfIn.
In sum, the processing through the Outsourced database wrapper has increased two tuple t newly in the original tables of data
MinWith t
Max, and expanded two new attribute A
SeqWith A
Vrf
(2) Outsourced database SQL query checking
Outsourced database SQL query proof procedure occurs in user side.It comprises three key steps such as SQL query rewriting, Query Result authenticity verification, Query Result completeness verification:
The first step: SQL query is rewritten.
This step is made amendment to the query statement that the user submits to, makes it not only to return former SQL query result set, also returns the required information of checking result set simultaneously.Suppose that former query statement is a querying condition with attribute Ai, user inquiring statement Q
xAfter rewriting, become as next group polling:
(1) newly-increased query statement Q
Min, return the coboundary tuple t of this result set
UpWherein, coboundary tuple t
UpBe the next-door neighbour forerunner tuple of first tuple in the result set on attribute Ai;
(2) newly-increased query statement Q
Max, return the lower boundary tuple t of this result set
LowWherein, lower boundary tuple t
LowNext-door neighbour forerunner's tuple on attribute Ai is last tuple in the result set;
(3) revise user inquiring statement Q
xBe Q
x', return all properties, comprise the sequence notation attribute A of expansion
SeqWith identifying object attribute A
VrfThis inquiry return results collection T
x'.
Above-mentioned three inquiries are submitted to the server as a db transaction, then all return results are further handled.
If comprise a plurality of querying conditions in other query statements, promptly need on a plurality of attributes, inquire about respectively, then former querying condition can be inquired about respectively according to each attribute, resolve into the inquiry on a plurality of above-mentioned attributes like this after, carry out above-mentioned steps more successively and handle.
Second step: Query Result authenticity verification.
This step is used for the authenticity of the verification step one SQL result set that returns.Suddenly all tuple-sets that return for previous step (are t
Up∪ t
Low∪ T
x'), verify whether its integrality is destroyed.This proof procedure is realized by the concrete protection algorithm integrallty that database owner sets.RSA for example, signature algorithm such as DSA and various MAC algorithms etc.The tuple by checking is not directly abandoned.If border tuple t
UpOr t
LowBe dropped, then resubmit the border inquiry, seek next boundary value.Repeat this process until the border tuple t that finds table
MinOr t
Max
All tuple-sets by checking are for further processing.Comprise that two new border tuples (are labeled as t respectively
Up 2, t
Low 2), and the result set after the checking (is labeled as T
x 2).
The 3rd step: Query Result completeness verification.
This step is used to verify the completeness of SQL result set.For tuple-set and the up-and-down boundary tuple thereof after the step 2 screening, check whether they constitute a complete chain just for the sequence notation component of attribute Ai.That is: from lower boundary tuple t
Low 2Beginning ends at t
Up 2T
x 2In each tuple all occur and only occur 1 time.
If report that then completeness verification passes through, otherwise reporting errors.
Based on above-mentioned Outsourced database SQL query result verification method, the present invention also provides a kind of Outsourced database SQL query result verification system.Described system architecture is divided into four parts: the Outsourced database wrapper, module, Query Result completeness verification module, and Query Result authenticity verification module are rewritten in inquiry.
The deployment of this system and operational mode are as shown in Figure 2.Wherein, the Outsourced database wrapper is deployed in owner's end, and the Outsourced database after the owner will encapsulate is transferred to the server and safeguarded operation.Inquiry is rewritten module, Query Result completeness verification module and Query Result authenticity verification module and all is deployed in the user side that need carry out result verification.The SQL query that database user sent, after rewriting processing, enquiry module sends to server's end, its return results is verified the authenticity and the completeness of SQL query result set content respectively successively via Query Result authenticity verification module and Query Result completeness verification resume module.
The effect of above-mentioned Outsourced database wrapper is that each tables of data in the storehouse is carried out pre-service, embeds certain content so that the content that user rs authentication should be shown.It comprises two core components: the order object embeds assembly and identifying object embeds assembly, respectively embedding order object and identifying object in tables of data.The process that the encapsulation process of tables of data is promptly handled through two said modules successively.
Module is rewritten in above-mentioned inquiry will revise the query statement that the user submits to, make it not only to return former SQL query result set, also return the required information of this result set of checking simultaneously: comprise the up-and-down boundary tuple of former result set, and all return the sequence notation attribute and the identifying object attribute of tuple.
Above-mentioned Query Result authenticity verification module is used to verify the authenticity of SQL result set.Check above-mentioned inquiry rewrite module resulting all return tuple (comprising former SQL result set and border tuple thereof), judge whether the integrality of tuple destroyed.The concrete protection algorithm integrallty that this proof procedure sets by database owner.RSA for example, signature algorithm such as DSA and various MAC algorithms etc.Abandon all ruined tuples.
Above-mentioned Query Result completeness verification module is used to verify the completeness of SQL result set.The tuple-set of inspection after above-mentioned Query Result authenticity verification module screening checks whether the sequence notation of all tuples constitutes a complete chain just.If report that then completeness verification passes through, otherwise reporting errors.
Compared with prior art, good effect of the present invention is:
Adopt Outsourced database encapsulation of the present invention and Query Result verification method, can expand the outsourcing data-base content, embed specific authorization information, thereby under the prerequisite that does not change available data base management system function, allow domestic consumer that the authenticity and the completeness of outsourcing database SQL Query Result are verified.The present invention has the following advantages:
1, DBMS is transparent.Support main flow business data base management system;
2, dirigibility height.Proof procedure is initiated by the user, allows the user according to actual conditions the selectivity checking to be carried out in inquiry;
3, the accurate locator data position of distorting.Can locate wrong tuple, the user can obtain the correct result set of part.
Description of drawings
Fig. 1, existing Outsourced database operation scene and three class participants thereof;
Fig. 2, Outsourced database of the present invention encapsulation and SQL query result verification system construction drawing;
Wherein: 1---conventional database systems, 2---the Outsourced database wrapper, 3---SQL query result verification system;
Fig. 3, method flow diagram of the present invention.
Embodiment:
The present invention will be further described in detail below in conjunction with accompanying drawing and an example, but the scope that does not limit the present invention in any way.Method flow of the present invention as shown in Figure 3.
In this example, suppose only to comprise a tables of data TestTable in the Outsourced database, but this table has 4 integer type ordering attribute: ID, A1, A2, A3.Wherein Property ID is the major key of table.Having 4 records in the table is respectively t1, t2, t3, t4.This table raw data is as follows:
The Outsourced database owner carried out encapsulation process to database before it is submitted to the server.
(1) Outsourced database encapsulation process
The first step: embed assembly through the order object and handle, the owner is embedding order object in TestTable.Comprise: (1) has increased by two border tuples (being respectively record t0 and t999), and (2) have expanded sequence notation attribute (A_seq), and is all tuples calculating genesis sequence flag attribute contents.The TestTable table thes contents are as follows after this resume module:
Be example with t3 tuple (tuple of ID=3) below, the generative process of its attribute A_seq content is described.
If the value of all tuples according to attribute A1 sorted, next-door neighbour forerunner's tuple of t3 is t2; If according to A2 or A3 ordering, then next-door neighbour forerunner's tuple of t3 is respectively t2 or t0.Therefore the sequence notation of t3 is (2,2,0).Its content zip (2,2,0) after overcompression is kept among the A_seq.[annotate: when next-door neighbour forerunner tuple value is not unique, get Major key the maximum.For t3, t2, t1 have identical A2 property value (t2.A2=t1.A2=7), thus get the maximum tuple t2 of ID value (because t2.ID>t1.ID).In like manner according to the A2 ordering, next-door neighbour forerunner's tuple of t2 is t1.】
Second step: foregoing is transferred to identifying object and is embedded the assembly processing, further embeds identifying object in expansion TestTable table.What suppose use is signature algorithm, through after this resume module, this table expansion of content attribute A_sig, become following form:
Be example still below, the generative process of A_sig is described with t3 tuple (tuple of ID=3).
The signature S3=SIG of tuple t3 (h (3||6||9||5||zip (2,2,0))
PRSIG () wherein
PRIt is signature function; Signature key is possessory private key PR.
Be contracted out to the server through the table TestTable after the encapsulation process.Server end administration oracle database management system provides the inquiry service to this database table.
(2) Outsourced database enquiry proof procedure
Suppose that the user need submit following inquiry to:
qs:SELECT*FROM?TestTable?WHERE?A1>4?AND?A1<7;
The predetermined result collection of this inquiry should be Tx={t2, t3}.
If the user need verify Query Result, need to carry out successively following processing so:
Resume module is rewritten in the first step, inquiry.
This module is that qs has increased following two inquiries:
qx:SELECT*FROM?TestTable?WHERE?A1?IN
(SELECT?Max(A1)FROM?TestTable?WHERE?A1<=4);
qy:SELECT*FROM?TestTable?WHERE?A1?IN
(SELECT?Min(A1)FROM?TestTable?WHERE?A1>=7);
Wherein qx returns tuple t1, and qy returns tuple t4.Be respectively predetermined result collection { t2, the up-and-down boundary of t3}.That is: t
Up=t1, t
Low=t4.
For the validity of illustration method, we suppose that tuple t2 loses in the Outsourced database.Only comprise tuple t3, i.e. a Tx={t3} in the actual SQL of the returning result set.Tuple t so
Up=t1, t
Low=t4 and tuple-set Tx={t3} transfer to next step processing.
Second step, authenticity verification resume module.
This module is verified the authenticity of concentrated each tuple of above-mentioned return results by adopting signature algorithm, promptly connects all properties value except that A_sig in the tuple successively, and calculates its signature S.Relatively whether S is consistent with the A_sig property value of tuple then.If unanimity is then passed through checking, otherwise judges that this tuple content is destroyed.
With tuple t3 is example, checking SIG (h (3||6||9||5||zip (2,2,0))
PRWhether equal S3.If equate then to pass through checking, otherwise verify and do not pass through that tuple is dropped.Suppose that three tuples are all by checking, tuple t so
2 Up=t1, t
2 Low=t4 and tuple-set T
2X={t3} constitutes true tuple-set, transfers to next step execution.
The 3rd step, completeness verification resume module.
Whether this module verification The above results is complete.Because querying condition is at attribute A1, so need extract first component in each tuple sequence notation during checking.By lower boundary tuple t
2 Low=t4 begins, and progressively whether the checks sequence chain is complete.Obtain sequence notation after t4.Aseq decompresses and be (3,0,3), its first component, promptly the sequence notation component at attribute A1 is 3.Show that its forerunner's tuple should be t3, because t3 ∈ Tx begins to handle tuple t3 below.The sequence notation component that in like manner calculates t3 is 2, yet t2 does not belong to result set Tx, shows and exist tuple to lose.And the tuple A1 property value of losing is between t3.A1 and t1.A1.Therefore this checking is not passed through.But can confirm that t3 is correct as a result.