<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>TEAL: Transparent Encryption for the Database Abstraction Layer</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Karl Lorey</string-name>
          <email>karl.lorey@student.kit.edu</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Erik Buchmann</string-name>
          <email>buchmann@hft-leipzig.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Klemens Bohm</string-name>
          <email>klemens.boehm@kit.edu</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Hochschule fur Telekommunikation</institution>
          ,
          <addr-line>04277 Leipzig</addr-line>
          ,
          <country country="DE">Germany</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Karlsruhe Institute of Technology</institution>
          ,
          <addr-line>76131 Karlsruhe</addr-line>
          ,
          <country country="DE">Germany</country>
        </aff>
      </contrib-group>
      <fpage>145</fpage>
      <lpage>152</lpage>
      <abstract>
        <p>ion Layer of a database system. TEAL is an implementation of a framework for secure storage and resides inside Abstraction Layer of a database (DBAL). We demonstrate how TEAL integrates transparently into existing applications. Furthermore, we explain query processing on encrypted data by re-using components of the DBAL. Finally, we visualize the impact of the processing steps of TEAL on the run-time performance of the query processing. Our demonstration shows that TEAL allows to integrate secure storage easily and with a reasonable increase of the execution times into object-relational mapping.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Outsourcing databases has become a matter of course. By hosting data from
many customers, specialized service providers can o er cost-e cient database
services with de ned service levels that adapt to exible loads. However, data
privacy laws [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] and business secrets in the data frequently prohibit outsourcing
unencrypted databases to external service providers. Naive encryption solves this
problem, but is equivalent to a restriction to plain storage. To tackle this issue,
a number of approaches [
        <xref ref-type="bibr" rid="ref1 ref3 ref6 ref8">6, 1, 3, 8</xref>
        ] have been proposed to encrypt databases in a
way that certain types of queries can be e ciently executed without knowing the
encryption key and without disclosing too much private information [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. Such
approaches use a trusted middleware that rewrites each query from the client.
The rewritten query can be executed over the encrypted data at the server side.
The server answers then with an encrypted result set that might contain more
data than requested. Subsequently, the middleware decrypts this result and does
some post- ltering in order to deliver the nal query results to the client.
      </p>
      <p>While this process has been formally described, the realization of such a
middleware is not obvious: First of all, the encryption must be transparent both
to the database service provider and the application developer, to re-use
existing services and software components. Second, in the worst case the service
provider must transfer the entire database to the middleware at the client for
local decryption. Thus, data management at the middleware is an issue. Third,
the middleware must be able to pass transactions between client and database
provider. Fourth, it is important that the middleware is interoperable with the
speci c SQL dialects of di erent database vendors. Finally, the run-time
overhead of the encryption is important.</p>
      <p>
        This demo will feature TEAL, our approach for Transparent Encryption in
the Abstraction Layer of a database system. TEAL implements a well-researched
framework for secure storage [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] in the database abstraction layer (DBAL). This
allows us to abstract from vendor-speci c extensions of the SQL standard, and
to realize fully transparent database encryption without having to interfere with
the transactional mechanisms of the database or the application.
      </p>
      <p>Our demonstration provides insight into three aspects: We show that the
integration of TEAL into existing applications is feasible with moderate e ort.
To this end, we have implemented TEAL for PHP applications using Laravel,
that is, we realize secure storage for object-relational mapping. We explain in
detail how TEAL encrypts data, executes a certain query over encrypted data
and obtains the plain-text query result. As part of our demo we show that the
run-time overhead induced by the encryption is reasonable.</p>
      <p>Paper structure: The next section introduces the foundations of our
approach. Section 3 provides an overview of TEAL. Section 4 describes our demo
and Section 5 concludes.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Fundamentals</title>
      <p>
        This section brie y describes the approach [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] we have used as a basis for our
work and explains the database abstraction layer (DBAL).
2.1
      </p>
      <sec id="sec-2-1">
        <title>SQL over Encrypted Data</title>
        <p>
          We have based TEAL on Hacigumus' algebraic framework [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ], because it allows
exact-match access to all columns with a limited number of false positives in
the encrypted result set, which is important for object-relational mapping. In
contrast, approaches such as [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ] require the client to download and decrypt the
entire database whenever a sensitive column is queried. Order-preserving
encryption [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ] is prone to statistical attacks when the adversary can access the query
log. Approaches like CryptDB [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ] need to extend the entire server infrastructure
from the application server over a proxy server to the DBMS.
        </p>
        <p>
          In the following, we brie y describe [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ]. Let R(A1; A2; : : : ; An) be a plain-text
relation R with attributes A1; : : : ; An. The framework transforms this relation
into an encrypted relation RS(etuple; A1S; A2S; : : : ; ASn). etuple is an encrypted
copy of the original tuple A1; : : : ; An, i.e., the middleware can decrypt the
original tuple from etuple. A1S; A2S; : : : ; ASn are encrypted and binned index values that
allow for certain searches. Due to binning, several plain-text values are mapped
to the same encrypted index value. Thus, the service provider cannot infer the
order and the distribution of the original data. However, queries on RS tend to
contain false positives. Consider the relation emp containing all employees:
emp: id name salary address
1 Alice 1000 N.Y.
2 Bob 2000 L.A.
        </p>
        <p>3 Carol 3000 N.Y.</p>
        <p>This relation would be encrypted and stored as encrypted table enc as follows:
enc: etuple I1 I2 I3 I4
enc(1, Alice, 1000, N.Y.) e1 e5 e3 e2
enc(2, Bob, 2000, L.A.) e7 e5 e6 e2
enc(3, Carol, 3000, N.Y.) e7 e4 e6 e2</p>
        <p>With e1 e7 we refer to encrypted index values. Some plain-text values are
mapped to the same encrypted value. For example, Employee Id 1 has been
mapped to bin e1, while the Ids 2 and 3 have been mapped to e7.</p>
        <p>
          To process queries on encrypted data, the encryption middleware rewrites
plain-text queries from the client according to translation rules for relational
algebra [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ]. For example, SELECT name, salary FROM emp WHERE id = 2
translates to SELECT etuple FROM enc WHERE I1 = e7. The server executes the
rewritten query over encrypted data without knowing the decryption key. It returns
an encrypted result set to the middleware. The translation rules ensure that the
result set is a superset of the data queried. In our example, the result set is
fenc(2, Bob, 2000, L.A.), enc(3, Carol, 3000, N.Y.)g. Finally, the
middleware decrypts the result set and computes the nal query result. The
encryption can be parametrized so that for typical queries the e ort for decryption and
post-processing on the client side is small. However, in extreme cases the server
might send the entire encrypted database to the client. While the formal process
is well de ned (cf. [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ]), its practical realization leaves open a number of issues.
        </p>
        <p>
          Querying encrypted data always reveals some information to the service
provider [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ]. Re nements exist that mitigate the impact of some issues, e.g.,
for range queries [
          <xref ref-type="bibr" rid="ref2 ref7">7, 2</xref>
          ]. TEAL allows to integrate such approaches easily.
2.2
        </p>
      </sec>
      <sec id="sec-2-2">
        <title>The Database Abstraction Layer</title>
        <p>Many Database Abstraction Layers (DBALs) have been proposed so far to
overcome the heterogeneity introduced by SQL vendors, to gain independence
from SQL dialects and from database vendors. Popular DBALs are
objectrelational mappers such as hibernate3, the Java Persistence API4 or Laravel5.</p>
        <sec id="sec-2-2-1">
          <title>3 http://hibernate.org</title>
        </sec>
        <sec id="sec-2-2-2">
          <title>4 http://www.oracle.com/technetwork/java/javaee</title>
        </sec>
        <sec id="sec-2-2-3">
          <title>5 http://laravel.com</title>
          <p>Other DBALs provide language-level abstraction (JDBC, ODBC) or service-level
abstraction (e.g., Apache SPARK6). The resulting software is vendor-agnostic,
meaning that the underlying DBMS can be changed easily.</p>
          <p>A transparent integration into a DBAL allows to migrate to secure storage
without having to re-write existing applications. It also makes TEAL
independent from speci c database vendors, because this is already obtained by DBAL.
Furthermore, an integration into DBAL allows a seamless integration into the
transaction processing between application and database server. The integration
into a DBAL allows to re-use e cient libraries for query processing. Finally,
DBALs focus on programming interfaces and prohibit direct access to indexes
and other database-speci c features. This makes it easier to realize a secure
storage approach, because no side-channels have to be considered.</p>
          <p>To demonstrate that TEAL provides secure storage which can be integrated
into existing applications seamlessly, we have implemented it in PHP using
Laravel. PHP and Laravel are typical components of LAMP 7 servers that handle
a wide share of today's Web load. Laravel is a DBAL that provides an
objectoriented persistence interface for MySQL, Postgres, SQLite, and SQL Server.
3</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Transparent Encryption in the DB Abstraction Layer</title>
      <p>
        TEAL provides secure storage [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] within a Database Abstraction Layer.
It integrates encryption, query rewriting and post-processing of decrypted
results into the Laravel object-relational mapper, as shown in Figure 1.
`LaravelnBuilder' subsumes IlluminatenDatabasenQuerynBuilder and connected
Lar
      </p>
      <sec id="sec-3-1">
        <title>6 http://spark.apache.org</title>
      </sec>
      <sec id="sec-3-2">
        <title>7 LAMP refers to a software package containing Linux, Apache, MySQL and PHP.</title>
        <p>avel classes. Dashed lines represent 'uses' relations between components, and
continuous lines stand for 'implements' relations.</p>
        <p>TEAL consists of four components:
Con guration: This component stores all meta data that is needed for
encryption, query rewriting and database access in a local database on the client.
This includes the encryption and binning methods used, the encryption key, and
the range and number of bins used for the encrypted indexes. It also includes
the mapping from plain-text identi ers of databases, tables and columns on the
client side to encrypted ones on the server side.</p>
        <p>Installation: The installation component comes as an installation package that
recon gures an existing LAMP installation for secure storage. That is, it
integrates TEAL in between the PHP application and the Laravel library so that
TEAL can encrypt queries and post-process encrypted query results.
Furthermore, the installation provides a user interface to the con guration parameters.
Builder: The TEALnBuilder obtains plain-text queries from the PHP
application via the LaravelnBuilder interface. It translates them to queries over
encrypted data, and passes this translation to the native Laravel library.
Conversely, the Builder obtains and decrypts the encrypted intermediate results
from the server side. It passes them to Post-Processing and transfers the nal
result set to the PHP application. To this end, the TEALnBuilder interacts with
the LaravelnBuilder component.</p>
        <p>Post-Processing: The translated query yields an encrypted superset of the
data sought. The Post-Processing computes the nal query result from the
decrypted superset. This includes sorting, grouping, and ltering. In the rst step,
our Post-Processing component evaluates predicates from the WHERE-condition
of the query. In a second step, we put the resulting data set into a client-side
database system8 and execute the original (unencrypted) query. The
clientside database must have the same vendor and schema as the original database.
This lets us obtain the nal query result e ciently and without having to
reimplement database functionality inside the DBAL.
4</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Demonstration</title>
      <p>Our demonstration database for TEAL will have 100,000 rows, one column of
sequential tuple IDs and two columns of uniformly distributed integers. This
results in a table size of 4.3 MB and an index size of 2.2 MB for the primary
key. The given data distribution allows us to demonstrate queries with a given
selectivity. We use AES-256-CBC for encryption. The encrypted indexes are
binned with a bucket size of 100, i.e., on average each bucket holds 1000 values.
We are executing our demonstration on a machine with PostgreSQL 9.3, Intel
Core i7 4770k, 16GB RAM and a Solid State Disk. Our PHP application mimics
a typical dynamic web application.</p>
      <sec id="sec-4-1">
        <title>8 `Local Storage' in Figure 1</title>
        <p>First we demonstrate how TEAL integrates seamlessly and transparently into
existing PHP applications. To this end, the installation component of TEAL
comes with a setup wizard. Once TEAL has been installed, the setup wizard can
be accessed via a web interface. We will guide the audience through the various
steps of the setup. This includes the selection of the tables to be encrypted,
the selection of the keys and parameters for the encryption and the binning,
and the con guration of a database connection to a third-party provider storing
encrypted data. Based on this information, the wizard converts the plain-text
database into an encrypted one and transfers it to the database provider.</p>
        <p>At the end of this part of the demonstration, a secure storage at the server
side exists. It can be used by modifying a line in the con guration le of Laravel,
i.e., without having to modify the PHP application. With our demonstration
setup, the secure storage contains one table with four columns: the etuple column
containing the encrypted tuples and the three columns containing encrypted and
binned index values. The encrypted table has a size of 11 MB and an index of
the same size.
4.2</p>
        <sec id="sec-4-1-1">
          <title>Querying Encrypted Data</title>
          <p>Second, we demonstrate how TEAL rewrites queries for execution on the
encrypted storage, and how it computes the result set from the encrypted answer
(see Figure 2).</p>
          <p>TEAL obtains a plain-text query over the Laravel API, i.e., all method calls
to LaravelnBuilder are redirected to TEALnBuilder. In detail, Laravel allows the
application developer to formulate queries using object-oriented method calls
that correspond to FROM, WHERE conditions, JOIN, GROUP BY etc. The Builder
constructs an internal query representation from these calls. Figure 2 subsumes
these calls under specify query(). To execute a query on the database, the
application eventually invokes the method get().</p>
          <p>
            Once get() is invoked, TEAL translates this query representation into one
that can be executed on encrypted data [
            <xref ref-type="bibr" rid="ref6">6</xref>
            ], using the original method calls of
Laravel. Our demonstration will visualize this transformation process for
arbitrary queries. Laravel executes the encrypted query and returns an array of
encrypted objects containing etuples to TEALnBuilder. After decryption, this
array contains more data objects than requested and needs to be ltered and
post-processed. Again, we will demonstrate the decryption and post-processing
step. Finally, TEAL returns the array with the nal query result to the PHP
application through the Laravel API.
4.3
          </p>
        </sec>
        <sec id="sec-4-1-2">
          <title>Run-Time Performance</title>
          <p>The third part of our demo addresses the run-time penalty of TEAL. To this
end, we measure the execution time of the query which we have demonstrated.
250
200
isn150
e
im100
t
50
0
plain-text
predicates
total
100
80
%
in 60
e
itm40
20
00
decryption
post-proc.
query ex.
0 20 40 60 80 100
result size in 1,000 tuples</p>
          <p>0,5 1 1,5
result size in 1,000 tuples
2</p>
          <p>We show the increase of the run-time due to using secure storage rst. In
particular, we vary the WHERE condition of the query to obtain query results of
varying size (cf. Figure 3). First we determine the execution time of a plain-text
query processing without using TEAL (continuous line in Figure 3). Second,
we measure the run-time of a query processing with TEAL by ltering for the
WHERE predicates, i.e., without fetching the ltered query result into a client-side
database for further post-processing such as grouping and sorting (dotted line
in the gure). Third, we measure the total run-times using TEAL (dashed line).</p>
          <p>Finally, we visualize the proportions of the various processing steps of TEAL
on the total run-time of a query execution (see Figure 4). Again, we vary the
result size by modifying the WHERE predicates of the query. We will show the
execution times of the query rewriting, query execution (dark gray in the
Figure), result decryption (white) and post-processing (light gray). Query execution,
which is handled by Laravel, has a share of about 30% of the execution time,
while client-side decryption needs around 60% of the time. Notice that query
execution and decryption are handled by a specialized DBMS and a highly
optimized crypto-library. Thus, this part of the demo shows that integrating TEAL
into a less performant scripting language such as PHP does not incur
unreasonable costs.
5</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>Summary</title>
      <p>The purpose of this demonstration is to show how a formal framework for query
processing on encrypted data can be integrated into an existing software
architecture. To this end, we present TEAL, our approach for Transparent Encryption in
the Abstraction Layer of a database system (DBAL). TEAL implements a
stateof-the-art framework for secure storage that re-uses the application programming
interface of the Laravel DBAL. This allows TEAL to integrate seamlessly into
PHP applications using Laravel, including object-relational mapping,
transaction management, storage management and database-vendor independence.</p>
      <p>Our demonstration reveals how our installation component achieves this
integration. Furthermore, we explain how TEAL re-writes and processes a given
plain-text query, and how it obtains the correct plain-text query result from the
encrypted response provided by the secure storage provider. Finally, we show
the increase in the execution times of a query as a result of encryption. Our
demonstration visualizes which processing step of TEAL requires which share of
the execution time. We demonstrate that TEAL scales linearly with the size of
the query result.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>R.</given-names>
            <surname>Agrawal</surname>
          </string-name>
          et al.
          <article-title>Order Preserving Encryption for Numeric Data</article-title>
          .
          <source>In Proc. of the ACM SIGMOD Intl. Conference on Management of Data</source>
          ,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>R.</given-names>
            <surname>Agrawal</surname>
          </string-name>
          et al.
          <article-title>Order Preserving Encryption for Numeric Data</article-title>
          .
          <source>In Proc. of the ACM SIGMOD International Conference on Management of Data</source>
          ,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>V.</given-names>
            <surname>Ciriani</surname>
          </string-name>
          et al.
          <article-title>Combining Fragmentation and Encryption to Protect Privacy in Data Storage</article-title>
          .
          <source>ACM Transactions on Information and System Security</source>
          ,
          <volume>13</volume>
          (
          <issue>3</issue>
          ),
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>E.</given-names>
            <surname>Damiani</surname>
          </string-name>
          et al.
          <article-title>Balancing Con dentiality and E ciency in Untrusted Relational DBMSs</article-title>
          .
          <source>In Proc. of the ACM Conference on Computer and Communications Security</source>
          ,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>European</surname>
          </string-name>
          <article-title>Parliament and the Council of the European Union</article-title>
          .
          <source>Directive</source>
          <volume>95</volume>
          /46/EC. O
          <source>cial Journal L</source>
          <volume>281</volume>
          ,
          <issue>11</issue>
          /23/1995, p.
          <fpage>31</fpage>
          .,
          <year>1995</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>H.</given-names>
            <surname>Hacigu</surname>
          </string-name>
          <article-title>mus et al</article-title>
          .
          <article-title>Executing SQL over Encrypted Data in the Database-ServiceProvider Model</article-title>
          .
          <source>In Proc. of the ACM SIGMOD Intl. Conference on Management of Data</source>
          ,
          <year>2002</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>B.</given-names>
            <surname>Hore</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Mehrotra</surname>
          </string-name>
          , and
          <string-name>
            <given-names>G.</given-names>
            <surname>Tsudik</surname>
          </string-name>
          .
          <article-title>A Privacy-preserving Index for Range Queries</article-title>
          .
          <source>In Proc. of the International Conference on Very Large Data Bases</source>
          ,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>R. A.</given-names>
            <surname>Popa</surname>
          </string-name>
          et al.
          <article-title>CryptDB: Protecting Con dentiality with Encrypted Query Processing</article-title>
          .
          <source>In Proc. of the ACM Symposium on Operating Systems Principles</source>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>