include::../description.adoc[]


== Noncompliant Code Example

https://www.zetetic.net/sqlcipher/sqlcipher-for-android/[SQLCipher]

----
val key = "gb09ym9ydoolp3w886d0tciczj6ve9kszqd65u7d126040gwy86xqimjpuuc788g"
val db = SQLiteDatabase.openOrCreateDatabase("test.db", key, null) // Noncompliant
----

https://github.com/realm/realm-kotlin/[Realm]

----
val key = "gb09ym9ydoolp3w886d0tciczj6ve9kszqd65u7d126040gwy86xqimjpuuc788g"
val config = RealmConfiguration.Builder()
    .encryptionKey(key.toByteArray()) // Noncompliant
    .build()
val realm = Realm.getInstance(config)
----

== Compliant Solution

https://www.zetetic.net/sqlcipher/sqlcipher-for-android/[SQLCipher]

----
val db = SQLiteDatabase.openOrCreateDatabase("test.db", getKey(), null)
----

https://github.com/realm/realm-kotlin/[Realm]

----
val config = RealmConfiguration.Builder()
    .encryptionKey(getKey())
    .build()
val realm = Realm.getInstance(config)
----

include::../see.adoc[]
