# Internal Encryption mechanism and Library used in SQLCipher

**URL:** <https://discuss.zetetic.net/t/internal-encryption-mechanism-and-library-used-in-sqlcipher/1808>\
**Category:** Issues\
**Created:** [November 21, 2016, 6:05am UTC](https://discuss.zetetic.net/t/internal-encryption-mechanism-and-library-used-in-sqlcipher/1808 "2016-11-21T06:05:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![AshokKasthuri](https://avatars.discourse-cdn.com/v4/letter/a/5f9b8f/32.png) [@AshokKasthuri](https://discuss.zetetic.net/u/AshokKasthuri)\
**Post date:** [November 21, 2016, 6:05am UTC](https://discuss.zetetic.net/t/internal-encryption-mechanism-and-library-used-in-sqlcipher/1808/1 "2016-11-21T06:05:16Z")

</div>

Hi Team,

Please answer the below questions:

1. I am using Android studio and declared SQLCipher in dependencies and current size is 2.6 MB. What libraries it has internally ?

2. How the encryption is happening on both (KitKat and Nougat) ? Are the encryption libraries enclosed in above @aar file ? and what are they ? (EX : OPENSSL , Java Crypto provider)

3. And for 1000 rows below are the statistics on “SQLLite” and “SQLCipher” , is it true ?

Insert 10398 MS 185699 MS  
Update 6760 MS 10266 MS  
Read 52 MS 66 MS

---

<div class="post-metadata">

**Author:** ![developernotes](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/developernotes/32/1309_2.png) [@developernotes](https://discuss.zetetic.net/u/developernotes)\
**Post date:** [November 21, 2016, 4:34pm UTC](https://discuss.zetetic.net/t/internal-encryption-mechanism-and-library-used-in-sqlcipher/1808/2 "2016-11-21T16:34:47Z")

</div>

Hi @AshokKasthuri

> I am using Android studio and declared SQLCipher in dependencies and current size is 2.6 MB. What libraries it has internally ?

SQLCipher for Android utilizes SQLCipher internally, the community edition also includes OpenSSL for the crypto provider.

> How the encryption is happening on both (KitKat and Nougat) ? Are the encryption libraries enclosed in above @aar file ? and what are they ? (EX : OPENSSL , Java Crypto provider)

You can read about the design of SQLCipher [here](https://www.zetetic.net/sqlcipher/design/), also, you can review the source of SQLCipher for Android [here](https://github.com/sqlcipher/android-database-sqlcipher).

> And for 1000 rows below are the statistics on “SQLLite” and “SQLCipher” , is it true ?

The will be a performance impact moving from standard SQLite, often 5-15% depending on the application. We have some performance guidance for using SQLCipher [here](https://discuss.zetetic.net/t/sqlcipher-performance/14).

---

<div class="post-metadata">

**Author:** ![AshokKasthuri](https://avatars.discourse-cdn.com/v4/letter/a/5f9b8f/32.png) [@AshokKasthuri](https://discuss.zetetic.net/u/AshokKasthuri)\
**Post date:** [November 25, 2016, 10:23am UTC](https://discuss.zetetic.net/t/internal-encryption-mechanism-and-library-used-in-sqlcipher/1808/3 "2016-11-25T10:23:42Z")

</div>

Thank you for your reply.

It would be helpful to know why OpenSSL is proffered over Platform crypto ? any performance advantages please clarify.

The x86(closed to 1 MB) which is the part of library, is it going to be part of final Android APK file ?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![developernotes](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/developernotes/32/1309_2.png) [@developernotes](https://discuss.zetetic.net/u/developernotes)\
**Post date:** [November 28, 2016, 5:20pm UTC](https://discuss.zetetic.net/t/internal-encryption-mechanism-and-library-used-in-sqlcipher/1808/4 "2016-11-28T17:20:18Z")

</div>

Hi @AshokKasthuri

> [@AshokKasthuri](#):
>
> It would be helpful to know why OpenSSL is proffered over Platform crypto ?

SQLCipher for Android statically links OpenSSL as opposed to using the system provided version of OpenSSL. Historically the version of OpenSSL found on different Android devices varied; statically linking the library provides a guarantee of the version being used with the library.

> [@AshokKasthuri](#):
>
> The x86(closed to 1 MB) which is the part of library, is it going to be part of final Android APK file ?

Yes, unless you exclude x86 support within your build process.

---

<div class="post-metadata">

**Author:** ![Rayzet](https://avatars.discourse-cdn.com/v4/letter/r/ecc23a/32.png) [@Rayzet](https://discuss.zetetic.net/u/Rayzet)\
**Post date:** [December 15, 2016, 2:37pm UTC](https://discuss.zetetic.net/t/internal-encryption-mechanism-and-library-used-in-sqlcipher/1808/5 "2016-12-15T14:37:36Z")

</div>

Hello Nick,

You mention that one should be aware of potential import restrictions for some countries due to the inclusion of encryption technology.  
Have you ever considered to hookup directly to the Android Java encryption functions? Obviously that means a lot of JNI transitions. But it does lessen or maybe even remove the impact of import restrictions.  
Mainly wondering whether you tried it and discarded because of for example performance reasons, or maybe other reasons.

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![developernotes](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/developernotes/32/1309_2.png) [@developernotes](https://discuss.zetetic.net/u/developernotes)\
**Post date:** [December 15, 2016, 3:15pm UTC](https://discuss.zetetic.net/t/internal-encryption-mechanism-and-library-used-in-sqlcipher/1808/6 "2016-12-15T15:15:25Z")

</div>

Hello @Rayzet

That is not something we have done, however the performance impact of that design may likely be unacceptable due to the heavy marshaling that would be required due to the database library being written in C.

---

<div class="post-metadata">

**Author:** ![Rayzet](https://avatars.discourse-cdn.com/v4/letter/r/ecc23a/32.png) [@Rayzet](https://discuss.zetetic.net/u/Rayzet)\
**Post date:** [December 15, 2016, 3:29pm UTC](https://discuss.zetetic.net/t/internal-encryption-mechanism-and-library-used-in-sqlcipher/1808/7 "2016-12-15T15:29:07Z")

</div>

Hi,  
Yes i also expect as much, but i’m no JNI expert.  
Mainly wanted to confirm with you.  
Thank you for the fast response.
