# Technique for Searching Data in a Cryptographically Protected SQL Database
## 4 The Proposed Technique for Searching the Required Data
Then, trapdoors \(T_{k}\) are formed, on the basis of which a search will be carried out over the encrypted database. In the case under consideration, for \(w_{1}\) = '4454102135347018' and \(x_{1}\) = \(160634721428732436748471615956417046369\), the value of \(T_{1}\) = \(\mathrm{Enc}_{f(K^{k}_{1},K^{k}_{2},x_{1})}\) (\(R,j\), \(A_{enc}\), \(M_{enc}\), \(w_{1}\)) can be equal to '0512F7D59B92 BF08 EFEA52E0E488D1B67 CC1A25A57991C 2 BE00B1F3 5C2 AA9D310'. As noted above, encrypted trapdoor values for the same \(w_{1}\) keyword may differ. For example, when \(x^{\prime}1\) = 24339107466813018440859597836919234881, the value of \(T_{1}\)' is '1085E6 EB1A2C50E2352 BEA9D021A7C893129916490 DF199 BD34D1E87D436673'. Both one and the other value of trapdoor are equivalent when searching. The value \(T_{2}\) = '161349D2 EA5D997C80F5E60 FDDB7F6E17E206A483C19103E9A81680D1A92E71E' for \(w_{2}\) = '5167135104128196' and \(x_{2}\) = '3599148554236873577103527469752958778' is determined in a similar way. After that, based on the initial query \(Q\), the final query \(Q_{M}\) is formed. Namely, based on the preferences of the algorithms used and encryption modes (for definiteness, let these be \({}^{\prime}\)AES128' \(\in\)\(A_{enc}\) and \({}^{\prime}\)CBC\({}^{\prime}\)\(\in\)\(M_{enc}\)), the visibility of the query representation, as well as the specific implementation of the database on the Oracle DBMS platform, the query is converted to the following form:  
select id, at_1, at_2 from TABLE_1  
where get_decr_val(at_1, 'TABLE_1', 'at_1', 'AES128', 'CBC', id)) in (  
(select get_decr_val('0512F7D59B92 BF08 EFEA53E0E488D1B67 CC1A5E5A57991C2 BE00B1 F35C2 AA9D310', 'TABLE_1', 'at_1', 'AES128', 'CBC', 160634721428732436748471 615956417046369) from dual), (select get_decr_val('161349D2 EA5D997C80F5E60 FDDB7F6E17E206A483C19103E9A816 80D1A82E71E', 'TABLE_1', 'at_1', 'AES128', 'CBC', 33599148554236873577103527 4697529587778) from dual))  order by id;. Distinguishing features of the converted query are shown in bold type, where _get_decr_val_ is some function (\(F_{decr}(\alpha)=\text{Decr}_{(K_{1}^{R},K_{2}^{j},K_{\alpha})}(R,j,A_{encr},M_{encr },\alpha)\)) of special software, where \(\alpha\) is either the encrypted value of \(E_{K_{3}^{r}}\) stored in the \(\gamma\)-th row (_id_) of the \(j\)-th column (_at_1_) of some table \(R\) in the database (in this example it is _TABLE_1_), or the corresponding value of \(T_{k}\). This function is stored on the DBMS server in encrypted form. It implements a secure covert (without leaving traces in the available means of documenting completed queries) decryption of the data required for search (without displaying these data in the clear). \(K_{\alpha}\) is either a random number \(x_{k}\) or a unique row identifier (_id_) of some table \(R\) in the database. As can be seen from the above query \(Q_{M}\), sensitive data are not presented anywhere in the clear. After the query \(Q_{M}\) is formed, a command is issued to execute some procedure \(P_{DS}\), which determines the session parameters necessary for the legitimate user to work further in the active session. After that, the modified query \(Q_{M}\) itself is transferred to the DBMS server for execution. Features of the query implementation on the DBMS server  
As is known [26], in the fight against the threat caused by the illegal actions of a curious DBA or other external attacker with full access to data, there is a problem that lies in the contradiction between minimizing the amount of confidential information disclosed to the DBMS server and the ability to efficiently execute various queries. At that, existing approaches to working with encrypted data are either too slow or do not provide adequate confidentiality. On the other hand, it is also known that encrypting the data with some efficient cryptosystem would prevent many SQL queries from being executed by the DBMS server. In this case, the only practical solution would be to give the DBMS server access to the decryption key.