Reputation: 23
I want to use objectbox in my project, I want to migrate from dbflow to objectBox, dbflow is supporting encryption, does objectBox support encryption?
Upvotes: 0
Views: 2349
Reputation: 634
So in lieu of no official database encryption support from objectBox, we've gone the route of field encryption using the property converters.
We've implemented AES-256 encryption on String fields.
Thus far performance tests show the following:
Checkout this handy AES lib: https://github.com/scottyab/AESCrypt-Android
An example of the property converter class
class EncryptionConverter : PropertyConverter<String, String> {
override fun convertToDatabaseValue(entityProperty: String): String {
return AESUtil.encrypt("YOUR_SUPER_SECURE_KEY" , entityProperty)
}
override fun convertToEntityProperty(databaseValue: String?): String {
return AESUtil.decrypt("YOUR_SUPER_SECURE_KEY" , databaseValue)
}
}
Your field in entity class would look something like this
@Convert(converter = EncryptionConverter::class, dbType = String::class)
var username : String = ""
Also remember, with field encryption you're giving up partial field lookup capability
Upvotes: 2
Reputation: 1327
There is no built-in support for encryption.
There is a feature request to support it. We welcome your suggestions. https://github.com/objectbox/objectbox-java/issues/8
Upvotes: 1
Reputation: 411
ObjectBox currently depends on Android security features, which includes sandboxing and encrypted storage (depends on the Android version). Additional efforts should be tracked in
this is the last state for this question from greenrobot
Upvotes: 0